File size: 859 Bytes
d01de5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#!/usr/bin/env python3
"""
Hugging Face Spaces entry point for Carsa AI Backend
This file ensures compatibility with HF Spaces conventions
"""
import os
import sys
# Add current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# Import the main FastAPI app
from main import app
# Hugging Face Spaces expects the app to be available as 'app'
# This is already handled by importing from main.py
if __name__ == "__main__":
import uvicorn
# Get port from environment (HF Spaces uses 7860)
port = int(os.environ.get("PORT", 7860))
print(f"๐ Starting Carsa AI Backend on port {port}")
print("๐ Accessible globally via Hugging Face Spaces")
uvicorn.run(
"main:app",
host="0.0.0.0",
port=port,
reload=False # Disable reload in production
)
|