File size: 693 Bytes
85dd3af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2bb2438
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import os
from dotenv import load_dotenv

# Load environment variables from .env file if present
load_dotenv()
    
# Ensure 'src' is in the Python path so we can import our modules
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))

from ui.layout import create_ui

if __name__ == "__main__":
    # Launch the application
    ui = create_ui()
    
    # Use environment variables for configuration, with safe defaults
    # 0.0.0.0 is required for Docker/Hugging Face Spaces
    server_name = os.getenv("GRADIO_SERVER_NAME", "0.0.0.0")
    server_port = int(os.getenv("GRADIO_SERVER_PORT", "7860"))
    
    ui.launch(server_name=server_name, server_port=server_port)