multimodalart HF Staff commited on
Commit
7c7586e
·
verified ·
1 Parent(s): 0cd2f20

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -140,8 +140,11 @@ def run_session() -> str:
140
  time.sleep(POLL_INTERVAL)
141
  continue
142
 
143
- frames = [_decode_jpeg_to_tensor(b) for b in buffer[:need]]
144
- buffer = buffer[need:]
 
 
 
145
  vid = _frames_to_video_tensor(frames)
146
 
147
  t0 = time.time()
 
140
  time.sleep(POLL_INTERVAL)
141
  continue
142
 
143
+ # Low latency: edit the FRESHEST frames and drop any backlog that piled
144
+ # up during the previous chunk's compute, so the output tracks "now".
145
+ chunk_bytes = buffer[-need:]
146
+ buffer = []
147
+ frames = [_decode_jpeg_to_tensor(b) for b in chunk_bytes]
148
  vid = _frames_to_video_tensor(frames)
149
 
150
  t0 = time.time()