mirror of
https://github.com/shirayu/whispering.git
synced 2024-11-25 02:11:00 +00:00
feat: add datatype in context
This commit is contained in:
parent
4fee6ee71a
commit
183edafc41
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue