#!/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 # Initialize app variable at module level app = None if is_hf_spaces: # HF Spaces mode: Set environment and create app 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() # Ensure app is always defined at module level for HF Spaces if app is None and not __name__ == "__main__": print("⚠️ Creating fallback app") from src.app import get_app app = get_app()