Spaces:
Runtime error
Runtime error
Upload run_hf_spaces.py
Browse files- run_hf_spaces.py +25 -0
run_hf_spaces.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Simple launcher for Hugging Face Spaces deployment.
|
| 4 |
+
This script ensures the app runs properly in the HF Spaces environment.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
|
| 10 |
+
# Add current directory to Python path
|
| 11 |
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 12 |
+
|
| 13 |
+
# Import and run the main app
|
| 14 |
+
from app import interface
|
| 15 |
+
|
| 16 |
+
if __name__ == "__main__":
|
| 17 |
+
# Launch with settings optimized for HF Spaces
|
| 18 |
+
interface.launch(
|
| 19 |
+
server_name="0.0.0.0", # Allow external connections
|
| 20 |
+
server_port=7860, # Default HF Spaces port
|
| 21 |
+
share=False, # Don't create shareable link (HF handles this)
|
| 22 |
+
show_error=True, # Show errors for debugging
|
| 23 |
+
quiet=False, # Show startup messages
|
| 24 |
+
inbrowser=False # Don't open browser (HF handles this)
|
| 25 |
+
)
|