This commit is contained in:
Yuta Hayashibe 2022-10-02 19:48:41 +09:00
parent 936d5d0c45
commit 847eee5819

View file

@ -21,7 +21,7 @@ async def serve_with_websocket_main(websocket):
) )
while True: while True:
logger.debug(f"Segment #: {idx}") logger.debug(f"Audio #: {idx}")
try: try:
message = await websocket.recv() message = await websocket.recv()
except ConnectionClosedOK: except ConnectionClosedOK:
@ -32,9 +32,9 @@ async def serve_with_websocket_main(websocket):
continue continue
logger.debug(f"Message size: {len(message)}") logger.debug(f"Message size: {len(message)}")
segment = np.frombuffer(message, dtype=np.float32) audio = np.frombuffer(message, dtype=np.float32)
for chunk in g_wsp.transcribe( for chunk in g_wsp.transcribe(
segment=segment, # type: ignore audio=audio, # type: ignore
ctx=ctx, ctx=ctx,
): ):
await websocket.send(chunk.json()) await websocket.send(chunk.json())