KYAGABA commited on
Commit
ea2aa20
·
verified ·
1 Parent(s): e072d50

added_main

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -19,7 +19,6 @@ from fastapi.middleware.cors import CORSMiddleware
19
  app = FastAPI()
20
 
21
  app.add_middleware(
22
-
23
  CORSMiddleware,
24
  allow_origins=["*"],
25
  allow_credentials=True,
@@ -71,6 +70,7 @@ try:
71
  # Move model to device
72
  combined_model = combined_model.to(device)
73
  combined_model.eval()
 
74
  except Exception as e:
75
  raise SystemExit(f"Error loading models: {e}")
76
 
@@ -138,4 +138,7 @@ async def predict(files: list[UploadFile]):
138
  return JSONResponse(
139
  status_code=500,
140
  content={"error": f"Error processing request: {str(e)}"}
141
- )
 
 
 
 
19
  app = FastAPI()
20
 
21
  app.add_middleware(
 
22
  CORSMiddleware,
23
  allow_origins=["*"],
24
  allow_credentials=True,
 
70
  # Move model to device
71
  combined_model = combined_model.to(device)
72
  combined_model.eval()
73
+ print("Models loaded successfully!")
74
  except Exception as e:
75
  raise SystemExit(f"Error loading models: {e}")
76
 
 
138
  return JSONResponse(
139
  status_code=500,
140
  content={"error": f"Error processing request: {str(e)}"}
141
+ )
142
+
143
+ if __name__ == "__main__":
144
+ uvicorn.run(app, host="0.0.0.0", port=7860)