-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
@wj21067855
Description
I want to transcribe text in audio in parallel, so I want to deploy this vibe voice in fastAPI, and expose an api which call from FE (react), I want to know does this tts model support do it in parallel?
Why I ask for this, as in the sample code,
@app.websocket("/stream")
async def websocket_stream(ws: WebSocket) -> None:
await ws.accept()
text = ws.query_params.get("text", "")
print(f"Client connected, text={text!r}")
cfg_param = ws.query_params.get("cfg")
steps_param = ws.query_params.get("steps")
voice_param = ws.query_params.get("voice")
try:
cfg_scale = float(cfg_param) if cfg_param is not None else 1.5
except ValueError:
cfg_scale = 1.5
if cfg_scale <= 0:
cfg_scale = 1.5
try:
inference_steps = int(steps_param) if steps_param is not None else None
if inference_steps is not None and inference_steps <= 0:
inference_steps = None
except ValueError:
inference_steps = None
service: StreamingTTSService = app.state.tts_service
lock: asyncio.Lock = app.state.websocket_lock
if lock.locked():
busy_message = {
"type": "log",
"event": "backend_busy",
"data": {"message": "Please wait for the other requests to complete."},
"timestamp": get_timestamp(),
}
print("Please wait for the other requests to complete.")
try:
await ws.send_text(json.dumps(busy_message))
except Exception:
pass
await ws.close(code=1013, reason="Service busy")
return
acquired = False
it only support the task tts one by one.
Metadata
Metadata
Assignees
Labels
No labels