ModelMatrix / app.py
Akshay4506's picture
Fix matrix path in app.py
912f906
raw
history blame contribute delete
622 Bytes
import sys
import os
from pathlib import Path
# Add backend to sys.path so we can import modules correctly
# We add both backend/ and backend/code to the path
backend_path = Path(__file__).parent / "matrix"
sys.path.append(str(backend_path))
sys.path.append(str(backend_path / "code"))
# Import the FastAPI app from main.py in the backend folder
from main import app
# For Hugging Face Spaces, the file must be named app.py or main.py
# and the app instance must be called 'app'.
if __name__ == "__main__":
import uvicorn
port = int(os.environ.get("PORT", 7860))
uvicorn.run(app, host="0.0.0.0", port=port)