H2P3B / src /database.py
muhammadshaheryar's picture
Update src/database.py
c6f5794 verified
raw
history blame contribute delete
537 Bytes
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)