ruimartinscorrea commited on
Commit
fbcaed1
·
verified ·
1 Parent(s): 5f9387c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -1,6 +1,26 @@
1
  from dotenv import load_dotenv
2
  load_dotenv()
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # --- PATCH HuggingFace hub BEFORE anything else ---
5
  import src.patch_huggingface_hub
6
 
 
1
  from dotenv import load_dotenv
2
  load_dotenv()
3
 
4
+ import os
5
+ import subprocess
6
+ import sys
7
+
8
+ # --- Hugging Face Browser Setup ---
9
+ # This installs the Chromium browser needed for the agent to "see"
10
+ # because HF Spaces don't come with a browser pre-installed.
11
+ def install_browser():
12
+ print("Installing Chromium for Hugging Face...")
13
+ try:
14
+ subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"], check=True)
15
+ # install-deps installs the Linux system libraries for the browser
16
+ subprocess.run([sys.executable, "-m", "playwright", "install-deps"], check=True)
17
+ print("Chromium installed successfully!")
18
+ except Exception as e:
19
+ print(f"Error installing browser: {e}")
20
+
21
+ # Run installation
22
+ install_browser()
23
+
24
  # --- PATCH HuggingFace hub BEFORE anything else ---
25
  import src.patch_huggingface_hub
26