File size: 1,139 Bytes
1055c12
 
 
0354298
0b142d7
1055c12
0b142d7
 
 
e7f6bbd
0b142d7
6dd1eb7
 
 
 
1055c12
e7f6bbd
 
 
 
 
 
 
 
 
 
 
1055c12
 
0b142d7
1055c12
 
0b142d7
 
 
 
 
 
6dd1eb7
 
 
0b142d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import sys
from pathlib import Path

# Add current directory to Python path
current_dir = Path(__file__).parent.absolute()
if str(current_dir) not in sys.path:
    sys.path.append(str(current_dir))

# Configure Gradio environment
os.environ["GRADIO_ANALYTICS_ENABLED"] = "false"
os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0"
os.environ["GRADIO_SERVER_PORT"] = "7861"
os.environ["GRADIO_ALLOW_FLAGGING"] = "false"
os.environ["GRADIO_QUEUE_ENABLED"] = "false"

# Install browser dependencies if needed
try:
    from playwright.sync_api import sync_playwright
    with sync_playwright() as p:
        p.chromium.launch()
except Exception as e:
    print(f"Browser installation error: {e}")
    print("Attempting to install browser...")
    import subprocess
    subprocess.run(["playwright", "install", "chromium"], check=True)

from owl.webapp import create_ui

# Create Gradio interface
demo = create_ui()

# Launch the app
if __name__ == "__main__":
    demo.launch(
        server_name="0.0.0.0",
        server_port=7861,
        share=False,
        show_error=True,
        favicon_path=None,
        allowed_paths=None
    )