diff --git a/main.py b/main.py index 1179d012..c7591b74 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ from sqlmodel import Field, Session, SQLModel, or_, create_engine, select from sqlalchemy import func import subprocess +import uvicorn class AuraRequest(BaseModel): Department: Literal['menswear', 'womenswear'] @@ -56,6 +57,10 @@ def get_session(): app = FastAPI() +# Ensure the app listens on the correct port +if __name__ == '__main__': + uvicorn.run('main:app', host='0.0.0.0', port=8000) + app.add_middleware( CORSMiddleware, allow_origins=["*"], # Allow all origins @@ -68,6 +73,10 @@ def get_session(): def read_root(): return {"Hello": "World"} +@app.get("/health") +def health_check(): + return {"status": "ok"} + @app.on_event("startup") def on_startup(): create_db_and_tables() diff --git a/requirements.txt b/requirements.txt index 6c71807d..7bdd04b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,8 @@ opencv-python Pylette mediapipe imutils -fastapi +fastapi[all] uvicorn sqlmodel gunicorn +SQLAlchemy \ No newline at end of file diff --git a/requirements2.txt b/requirements2.txt new file mode 100644 index 00000000..d4d483cb Binary files /dev/null and b/requirements2.txt differ diff --git a/startup.sh b/startup.sh index b37b0f62..9a5b6862 100644 --- a/startup.sh +++ b/startup.sh @@ -1 +1,3 @@ -gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app +#!/bin/bash +python3 -m pip install -r requirements.txt +python -m uvicorn main:app --host 0.0.0.0