Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix bug
Browse files- app.py +1 -1
- simulation.py +0 -11
app.py
CHANGED
|
@@ -281,5 +281,5 @@ if __name__ == "__main__":
|
|
| 281 |
server_port=7860, # Hugging Face Space默认端口
|
| 282 |
share=False,
|
| 283 |
debug=False, # 生产环境建议关闭debug
|
| 284 |
-
allowed_paths=["./assets", "./logs"] #
|
| 285 |
)
|
|
|
|
| 281 |
server_port=7860, # Hugging Face Space默认端口
|
| 282 |
share=False,
|
| 283 |
debug=False, # 生产环境建议关闭debug
|
| 284 |
+
allowed_paths=["./assets", "./logs", "./tmp"] # 添加临时目录到允许路径
|
| 285 |
)
|
simulation.py
CHANGED
|
@@ -94,17 +94,6 @@ def stream_simulation_results(result_folder: str, task_id: str, request: gr.Requ
|
|
| 94 |
|
| 95 |
time.sleep(1) # 避免过于频繁检查
|
| 96 |
|
| 97 |
-
if max_time <= 0:
|
| 98 |
-
raise gr.Error("timeout 240s")
|
| 99 |
-
processed_files.add(filename)
|
| 100 |
-
has_new_frames = True
|
| 101 |
-
except Exception:
|
| 102 |
-
pass
|
| 103 |
-
if has_new_frames and len(frame_buffer) >= frames_per_segment:
|
| 104 |
-
segment_frames = frame_buffer[:frames_per_segment]
|
| 105 |
-
frame_buffer = frame_buffer[frames_per_segment:]
|
| 106 |
-
yield create_video_segment(segment_frames, fps, width, height)
|
| 107 |
-
time.sleep(1)
|
| 108 |
if max_time <= 0:
|
| 109 |
raise gr.Error("timeout 240s")
|
| 110 |
|
|
|
|
| 94 |
|
| 95 |
time.sleep(1) # 避免过于频繁检查
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
if max_time <= 0:
|
| 98 |
raise gr.Error("timeout 240s")
|
| 99 |
|