answerer-api / accelerator.py
DaniilAlpha's picture
Create accelerator.py
233feb1
raw
history blame
367 Bytes
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()