mirror of
https://github.com/shirayu/whispering.git
synced 2025-04-26 18:44:42 +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
|
vad_threshold: float
|
||||||
max_nospeech_skip: int
|
max_nospeech_skip: int
|
||||||
|
|
||||||
|
data_type: Optional[str] = "float32"
|
||||||
|
|
||||||
|
|
||||||
class ParsedChunk(BaseModel):
|
class ParsedChunk(BaseModel):
|
||||||
start: float
|
start: float
|
||||||
|
|
|
@ -66,7 +66,7 @@ async def serve_with_websocket_main(websocket):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.debug(f"Message size: {len(message)}")
|
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:
|
if ctx is None:
|
||||||
await websocket.send(
|
await websocket.send(
|
||||||
json.dumps(
|
json.dumps(
|
||||||
|
|
Loading…
Reference in a new issue