File size: 537 Bytes
c6f5794
dd1b74d
 
 
c6f5794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys
import os
from pathlib import Path

# Add the 'src' directory to the system path
# This fixes the 'ModuleNotFoundError: No module named database'
current_dir = Path(__file__).parent
src_path = str(current_dir / "src")
if src_path not in sys.path:
    sys.path.insert(0, src_path)

# Now we can safely import the app from src/main.py
from src.main import app

if __name__ == "__main__":
    import uvicorn
    # Hugging Face uses port 7860
    port = int(os.getenv("PORT", 7860))
    uvicorn.run(app, host="0.0.0.0", port=port)