Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -140,8 +140,11 @@ def run_session() -> str:
|
|
| 140 |
time.sleep(POLL_INTERVAL)
|
| 141 |
continue
|
| 142 |
|
| 143 |
-
frames
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
| 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()
|