James Frecheville commited on
Commit
e7f6bbd
·
1 Parent(s): 6dd1eb7

Update dependencies and add browser installation handling

Browse files
Files changed (2) hide show
  1. app.py +12 -2
  2. requirements.txt +1 -1
app.py CHANGED
@@ -7,14 +7,24 @@ current_dir = Path(__file__).parent.absolute()
7
  if str(current_dir) not in sys.path:
8
  sys.path.append(str(current_dir))
9
 
10
- # Disable browser installation and analytics
11
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "false"
12
- os.environ["GRADIO_BROWSER_INSTALLED"] = "true"
13
  os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
14
  os.environ["GRADIO_SERVER_PORT"] = "7861"
15
  os.environ["GRADIO_ALLOW_FLAGGING"] = "false"
16
  os.environ["GRADIO_QUEUE_ENABLED"] = "false"
17
 
 
 
 
 
 
 
 
 
 
 
 
18
  from owl.webapp import create_ui
19
 
20
  # Create Gradio interface
 
7
  if str(current_dir) not in sys.path:
8
  sys.path.append(str(current_dir))
9
 
10
+ # Configure Gradio environment
11
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "false"
 
12
  os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
13
  os.environ["GRADIO_SERVER_PORT"] = "7861"
14
  os.environ["GRADIO_ALLOW_FLAGGING"] = "false"
15
  os.environ["GRADIO_QUEUE_ENABLED"] = "false"
16
 
17
+ # Install browser dependencies if needed
18
+ try:
19
+ from playwright.sync_api import sync_playwright
20
+ with sync_playwright() as p:
21
+ p.chromium.launch()
22
+ except Exception as e:
23
+ print(f"Browser installation error: {e}")
24
+ print("Attempting to install browser...")
25
+ import subprocess
26
+ subprocess.run(["playwright", "install", "chromium"], check=True)
27
+
28
  from owl.webapp import create_ui
29
 
30
  # Create Gradio interface
requirements.txt CHANGED
@@ -13,4 +13,4 @@ colorama>=0.4.6
13
  psutil>=5.9.8
14
  docstring-parser>=0.15
15
  jsonschema>=4.0.0
16
- playwright==1.41.2
 
13
  psutil>=5.9.8
14
  docstring-parser>=0.15
15
  jsonschema>=4.0.0
16
+ playwright>=1.50.0