Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
PodcastMcpGradio - Main Entry Point
|
| 4 |
|
| 5 |
This is the main entry point for the PodcastMcpGradio application.
|
| 6 |
-
|
| 7 |
"""
|
| 8 |
|
| 9 |
import os
|
|
@@ -13,41 +13,17 @@ import sys
|
|
| 13 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
sys.path.insert(0, current_dir)
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
app
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
print("🤗 Detected HF Spaces environment")
|
| 25 |
-
os.environ["DEPLOYMENT_MODE"] = "local"
|
| 26 |
-
os.environ["HF_SPACES_MODE"] = "1" # Flag to prevent uvicorn
|
| 27 |
-
|
| 28 |
-
# Import and create app directly
|
| 29 |
-
from src.app import create_app
|
| 30 |
-
app = create_app()
|
| 31 |
-
print("✅ App created for HF Spaces")
|
| 32 |
|
| 33 |
-
|
| 34 |
-
#
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
# Re-export for compatibility
|
| 38 |
-
__all__ = ["create_app", "main", "get_app", "app"]
|
| 39 |
-
|
| 40 |
-
if __name__ == "__main__":
|
| 41 |
-
# Local development mode: use uvicorn
|
| 42 |
-
print("🏠 Local development mode")
|
| 43 |
-
from src.app import run_local
|
| 44 |
-
run_local()
|
| 45 |
-
else:
|
| 46 |
-
# Other environments
|
| 47 |
-
app = get_app()
|
| 48 |
-
|
| 49 |
-
# Ensure app is always defined at module level for HF Spaces
|
| 50 |
-
if app is None and not __name__ == "__main__":
|
| 51 |
-
print("⚠️ Creating fallback app")
|
| 52 |
-
from src.app import get_app
|
| 53 |
-
app = get_app()
|
|
|
|
| 3 |
PodcastMcpGradio - Main Entry Point
|
| 4 |
|
| 5 |
This is the main entry point for the PodcastMcpGradio application.
|
| 6 |
+
Simplified for Hugging Face Spaces deployment.
|
| 7 |
"""
|
| 8 |
|
| 9 |
import os
|
|
|
|
| 13 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
sys.path.insert(0, current_dir)
|
| 15 |
|
| 16 |
+
# Set environment for HF Spaces
|
| 17 |
+
os.environ.setdefault("DEPLOYMENT_MODE", "local")
|
| 18 |
+
os.environ.setdefault("HF_SPACES_MODE", "1")
|
| 19 |
|
| 20 |
+
# Import and create app
|
| 21 |
+
from src.app import create_app, run_local
|
| 22 |
|
| 23 |
+
# Create app instance
|
| 24 |
+
app = create_app()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
if __name__ == "__main__":
|
| 27 |
+
# Run the application
|
| 28 |
+
print("🚀 Starting PodcastMcpGradio application")
|
| 29 |
+
run_local()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|