Phantom Deploy commited on
Commit
4c31c50
·
1 Parent(s): 028fbde

Fix on_startup removed from Starlette (not supported in current version)

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -525,14 +525,13 @@ async def handle_health(request: Request):
525
  return Response(status, media_type="text/plain")
526
 
527
 
528
- app = Starlette(
529
- routes=[
530
  Route("/sse", endpoint=handle_sse),
531
  Route("/health", endpoint=handle_health),
532
  Mount("/messages/", app=sse.handle_post_message),
533
- ],
534
- on_startup=[bm.init],
535
- )
536
 
537
  if __name__ == "__main__":
 
 
538
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
525
  return Response(status, media_type="text/plain")
526
 
527
 
528
+ app = Starlette(routes=[
 
529
  Route("/sse", endpoint=handle_sse),
530
  Route("/health", endpoint=handle_health),
531
  Mount("/messages/", app=sse.handle_post_message),
532
+ ])
 
 
533
 
534
  if __name__ == "__main__":
535
+ import asyncio, threading
536
+ threading.Thread(target=lambda: asyncio.run(bm.init()), daemon=True).start()
537
  uvicorn.run(app, host="0.0.0.0", port=7860)