tudeplom commited on
Commit
9225a67
·
verified ·
1 Parent(s): ceda7cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -37,9 +37,10 @@ async def recognize_audio(websocket, path):
37
  finally:
38
  print(f"✅ Văn bản cuối cùng: {result_text.strip()}")
39
 
40
- # Chạy server WebSocket
41
- start_server = websockets.serve(recognize_audio, "0.0.0.0", 7860)
42
- print("🚀 WebSocket STT server đang chạy trên ws://0.0.0.0:7860")
 
43
 
44
- asyncio.get_event_loop().run_until_complete(start_server)
45
- asyncio.get_event_loop().run_forever()
 
37
  finally:
38
  print(f"✅ Văn bản cuối cùng: {result_text.strip()}")
39
 
40
+ async def main():
41
+ async with websockets.serve(recognize_audio, "0.0.0.0", 7860):
42
+ print("🚀 WebSocket STT server đang chạy trên ws://0.0.0.0:7860")
43
+ await asyncio.Future() # Giữ server chạy vô thời hạn
44
 
45
+ if __name__ == "__main__":
46
+ asyncio.run(main())