AurelioAguirre commited on
Commit
be8d239
·
1 Parent(s): baae755

changed to uvicorn setup for HF v3

Browse files
Files changed (1) hide show
  1. main/main.py +8 -0
main/main.py CHANGED
@@ -57,7 +57,15 @@ app.include_router(router, prefix=api_prefix)
57
  @app.on_event("startup")
58
  async def startup_event():
59
  """Initialize async components on startup."""
 
60
  await init_router(api)
 
 
 
 
 
 
 
61
 
62
  async def run_server():
63
  """Run the server directly (not through uvicorn)"""
 
57
  @app.on_event("startup")
58
  async def startup_event():
59
  """Initialize async components on startup."""
60
+ # Initialize the router
61
  await init_router(api)
62
+ # Launch the inference worker
63
+ server.launch_inference_worker()
64
+
65
+ @app.on_event("shutdown")
66
+ async def shutdown_event():
67
+ """Cleanup on shutdown."""
68
+ server.stop_inference_worker()
69
 
70
  async def run_server():
71
  """Run the server directly (not through uvicorn)"""