multimodalart HF Staff commited on
Commit
0b202ed
·
verified ·
1 Parent(s): 82e98f6

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -283,7 +283,7 @@ def stream(session_id: str) -> str:
283
  if audio.shape[1] > 0:
284
  b64 = base64.b64encode(_float_to_int16(audio[0].float().cpu().numpy()).astype("<i2").tobytes()).decode("ascii")
285
  yield f"{frame_ms:.1f}|{b64}"
286
- buf = (0.3, 0.55, 0.85)[max(0, min(2, int(c.get("buffer", 0))))]
287
  ahead = (emitted * FRAME_SAMPLES / SR) - (time.time() - t0)
288
  if ahead < -0.3: # fell behind (cold-start/hiccup) -> resync, no catch-up burst
289
  t0 = time.time() - (emitted * FRAME_SAMPLES / SR) + buf
 
283
  if audio.shape[1] > 0:
284
  b64 = base64.b64encode(_float_to_int16(audio[0].float().cpu().numpy()).astype("<i2").tobytes()).decode("ascii")
285
  yield f"{frame_ms:.1f}|{b64}"
286
+ buf = (0.15, 0.3, 0.5)[max(0, min(2, int(c.get("buffer", 0))))]
287
  ahead = (emitted * FRAME_SAMPLES / SR) - (time.time() - t0)
288
  if ahead < -0.3: # fell behind (cold-start/hiccup) -> resync, no catch-up burst
289
  t0 = time.time() - (emitted * FRAME_SAMPLES / SR) + buf