Spaces:
Runtime error
Runtime error
| 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) |