Spaces:
Paused
Paused
Commit
·
64e57d0
1
Parent(s):
87ae7cf
Update main.py
Browse files
main.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from typing import List, Union
|
2 |
-
from fastapi import FastAPI, WebSocket
|
3 |
from fastapi.responses import HTMLResponse, JSONResponse
|
4 |
|
5 |
from answerer import Answerer
|
@@ -72,7 +72,8 @@ async def answer(ws: WebSocket):
|
|
72 |
|
73 |
print("ws accepted!")
|
74 |
|
75 |
-
input = await ws.receive_text()
|
|
|
76 |
|
77 |
print("input received!")
|
78 |
|
|
|
1 |
from typing import List, Union
|
2 |
+
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
3 |
from fastapi.responses import HTMLResponse, JSONResponse
|
4 |
|
5 |
from answerer import Answerer
|
|
|
72 |
|
73 |
print("ws accepted!")
|
74 |
|
75 |
+
try: input = await ws.receive_text()
|
76 |
+
except WebSocketDisconnect: return
|
77 |
|
78 |
print("input received!")
|
79 |
|