Spaces:
Paused
Paused
File size: 367 Bytes
233feb1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from typing import Union
from fastapi import WebSocket
class Accelerator:
_connected = False
def connected(self): return self._connected
ws: Union[WebSocket, None]
async def connect(self, ws: WebSocket):
await ws.accept()
self.ws = ws
async def accelerate(self, input):
await self.ws.send_text(input)
return await self.ws.receive_text()
|