Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
feat: add datatype in context
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-zablit authored and shirayu committed Oct 17, 2022
1 parent 4fee6ee commit 77ed1c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions whispering/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion whispering/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 77ed1c7

Please sign in to comment.