Spaces:
Paused
Paused
Commit
·
7ace067
1
Parent(s):
76e5d9f
- accelerator.py +2 -6
accelerator.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
from typing import Union
|
| 2 |
from fastapi.websockets import WebSocket, WebSocketState
|
| 3 |
-
from websockets import ConnectionClosedError
|
| 4 |
|
| 5 |
class Accelerator:
|
| 6 |
ws: Union[WebSocket, None] = None
|
|
@@ -19,8 +18,5 @@ class Accelerator:
|
|
| 19 |
self.ws = ws
|
| 20 |
|
| 21 |
async def accelerate(self, input):
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
return await self.ws.receive_text()
|
| 25 |
-
except ConnectionClosedError:
|
| 26 |
-
self.ws = None
|
|
|
|
| 1 |
from typing import Union
|
| 2 |
from fastapi.websockets import WebSocket, WebSocketState
|
|
|
|
| 3 |
|
| 4 |
class Accelerator:
|
| 5 |
ws: Union[WebSocket, None] = None
|
|
|
|
| 18 |
self.ws = ws
|
| 19 |
|
| 20 |
async def accelerate(self, input):
|
| 21 |
+
await self.ws.send_text(input)
|
| 22 |
+
return await self.ws.receive_text()
|
|
|
|
|
|
|
|
|