File size: 622 Bytes
c4ff02d
 
 
 
 
 
912f906
c4ff02d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)