feat: add datatype in context

This commit is contained in:
charles-zablit 2022-10-17 10:53:59 +02:00 committed by Yuta Hayashibe
parent 4fee6ee71a
commit 183edafc41
2 changed files with 3 additions and 1 deletions

View file

@ -48,6 +48,8 @@ class Context(BaseModel, arbitrary_types_allowed=True):
vad_threshold: float
max_nospeech_skip: int
data_type: Optional[str] = "float32"
class ParsedChunk(BaseModel):
start: float

View file

@ -66,7 +66,7 @@ async def serve_with_websocket_main(websocket):
continue
logger.debug(f"Message size: {len(message)}")
audio = np.frombuffer(message, dtype=np.float32)
audio = np.frombuffer(message, dtype=np.dtype(ctx.data_type)).astype(np.float32)
if ctx is None:
await websocket.send(
json.dumps(