Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
soon-dubu committed Dec 7, 2024
2 parents b7ea27c + dea887b commit e901f0e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ opencv-python
Pylette
mediapipe
imutils
fastapi
fastapi[all]
uvicorn
sqlmodel
gunicorn
SQLAlchemy
Binary file added requirements2.txt
Binary file not shown.
4 changes: 3 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e901f0e

Please sign in to comment.