carsa_api / app.py
athmontech's picture
Initial commit: Carsa AI Backend for Hugging Face Spaces
d01de5d
raw
history blame contribute delete
859 Bytes
#!/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
)