Yhhxhfh commited on
Commit
a9877bd
1 Parent(s): 6293d43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -230,5 +230,7 @@ async def root():
230
  if __name__ == "__main__":
231
  initialize_redis()
232
  import asyncio
233
- asyncio.create_task(train_and_save_model())
234
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
 
 
230
  if __name__ == "__main__":
231
  initialize_redis()
232
  import asyncio
233
+ uvicorn.run(app, host="0.0.0.0", port=7860) # Start Uvicorn first
234
+
235
+ loop = asyncio.get_event_loop() # Get the current event loop
236
+ loop.create_task(train_and_save_model()) # Create the training task within the loop