xizaoqu commited on
Commit
a7ea928
·
1 Parent(s): 2769bd7
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -25,6 +25,7 @@ from datetime import datetime
25
  import spaces
26
  from algorithms.worldmem import WorldMemMinecraft
27
  from huggingface_hub import hf_hub_download
 
28
 
29
  torch.set_float32_matmul_precision("high")
30
 
@@ -278,13 +279,11 @@ def generate(keys):
278
  out_video = np.clip(out_video, a_min=0.0, a_max=1.0)
279
  out_video = (out_video * 255).astype(np.uint8)
280
 
281
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
282
- os.makedirs("outputs_gradio", exist_ok=True)
283
- filename = f"outputs_gradio/{timestamp}.mp4"
284
- save_video(out_video, filename)
285
 
286
  input_history += keys
287
- return out_video[-1], filename, input_history
288
 
289
  def reset():
290
  global memory_curr_frame
 
25
  import spaces
26
  from algorithms.worldmem import WorldMemMinecraft
27
  from huggingface_hub import hf_hub_download
28
+ import tempfile
29
 
30
  torch.set_float32_matmul_precision("high")
31
 
 
279
  out_video = np.clip(out_video, a_min=0.0, a_max=1.0)
280
  out_video = (out_video * 255).astype(np.uint8)
281
 
282
+ temporal_video_path = tempfile.NamedTemporaryFile(suffix='.mp4').name
283
+ save_video(out_video, temporal_video_path)
 
 
284
 
285
  input_history += keys
286
+ return out_video[-1], temporal_video_path, input_history
287
 
288
  def reset():
289
  global memory_curr_frame