Upload app.py with huggingface_hub
Browse files282 unmodified lines283284285286287288289282 unmodified linesif audio.shape[1] > 0:b64 = base64.b64encode(_float_to_int16(audio[0].float().cpu().numpy()).astype("<i2").tobytes()).decode("ascii")yield f"{frame_ms:.1f}|{b64}"buf = (0.3, 0.55, 0.85)[max(0, min(2, int(c.get("buffer", 0))))]ahead = (emitted * FRAME_SAMPLES / SR) - (time.time() - t0)if ahead < -0.3: # fell behind (cold-start/hiccup) -> resync, no catch-up burstt0 = time.time() - (emitted * FRAME_SAMPLES / SR) + buf282 unmodified lines283284285286287288289282 unmodified linesif audio.shape[1] > 0:b64 = base64.b64encode(_float_to_int16(audio[0].float().cpu().numpy()).astype("<i2").tobytes()).decode("ascii")yield f"{frame_ms:.1f}|{b64}"buf = (0.15, 0.3, 0.5)[max(0, min(2, int(c.get("buffer", 0))))]ahead = (emitted * FRAME_SAMPLES / SR) - (time.time() - t0)if ahead < -0.3: # fell behind (cold-start/hiccup) -> resync, no catch-up burstt0 = time.time() - (emitted * FRAME_SAMPLES / SR) + buf
app.py+1-1