#!/usr/bin/env python3 | |
""" | |
PodcastMcpGradio - Main Entry Point | |
This is the main entry point for the PodcastMcpGradio application. | |
It supports both local and Modal deployment modes. | |
""" | |
import os | |
import sys | |
# Add current directory to path for src imports | |
current_dir = os.path.dirname(os.path.abspath(__file__)) | |
sys.path.insert(0, current_dir) | |
# Detect environment early | |
is_hf_spaces = "SPACE_ID" in os.environ | |
if is_hf_spaces: | |
# HF Spaces mode: Set environment and prevent uvicorn from running | |
print("π€ Detected HF Spaces environment") | |
os.environ["DEPLOYMENT_MODE"] = "local" | |
os.environ["HF_SPACES_MODE"] = "1" # Flag to prevent uvicorn | |
# Import and create app directly | |
from src.app import create_app | |
app = create_app() | |
print("β App created for HF Spaces") | |
else: | |
# For other environments | |
from src.app import create_app, main, get_app | |
# Re-export for compatibility | |
__all__ = ["create_app", "main", "get_app", "app"] | |
if __name__ == "__main__": | |
# Local development mode: use uvicorn | |
print("π Local development mode") | |
from src.app import run_local | |
run_local() | |
else: | |
# Other environments | |
app = get_app() |