File size: 1,322 Bytes
90537f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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()