Changed protocol

This commit is contained in:
Yuta Hayashibe 2022-09-24 21:39:30 +09:00
parent e9534ec977
commit 1801a6b7e4

View file

@ -26,8 +26,9 @@ async def serve_with_websocket_main(websocket):
logger.debug(f"Message size: {len(message)}")
segment = np.frombuffer(message, dtype=np.float32)
chunks = [chunk.dict() for chunk in g_wsp.transcribe(segment=segment)]
await websocket.send(json.dumps(chunks))
for chunk in g_wsp.transcribe(segment=segment):
await websocket.send(chunk.json())
await websocket.send("")
idx += 1