Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Tabble-v3 Restaurant Management System | |
| Entry point for Hugging Face Spaces deployment | |
| """ | |
| import uvicorn | |
| import os | |
| import sys | |
| from pathlib import Path | |
| # Add the app directory to the Python path | |
| app_dir = Path(__file__).parent / "app" | |
| sys.path.insert(0, str(app_dir)) | |
| def main(): | |
| """Main entry point for the application""" | |
| # Create static directories if they don't exist | |
| os.makedirs("app/static/images/dishes", exist_ok=True) | |
| os.makedirs("templates", exist_ok=True) | |
| # Set environment variables for Hugging Face Spaces | |
| os.environ.setdefault("HUGGINGFACE_SPACES", "1") | |
| # Get port from environment (Hugging Face Spaces uses 7860) | |
| port = int(os.environ.get("PORT", 7860)) | |
| host = os.environ.get("HOST", "0.0.0.0") | |
| print(f"π Starting Tabble-v3 Restaurant Management System") | |
| print(f"π‘ Server: http://{host}:{port}") | |
| print(f"π API Documentation: http://{host}:{port}/docs") | |
| print(f"π₯ Health Check: http://{host}:{port}/health") | |
| print("=" * 60) | |
| # Start the FastAPI application | |
| uvicorn.run( | |
| "app.main:app", | |
| host=host, | |
| port=port, | |
| reload=False, # Disable reload in production | |
| log_level="info", | |
| access_log=True | |
| ) | |
| if __name__ == "__main__": | |
| main() |