rsax commited on
Commit
e8ed1c5
·
verified ·
1 Parent(s): 10daae7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import clip
3
  import torch
4
  import numpy as np
 
5
  import models.vqvae as vqvae
6
  import options.option_transformer as option_trans
7
  from utils.motion_process import recover_from_ric
@@ -73,9 +74,9 @@ def infer(text):
73
  gif_bytes = draw_to_batch([motion_data], [text], None)
74
 
75
  # Save the GIF to a temporary file
76
- temp_gif_path = "/tmp/animation.gif"
77
- with open(temp_gif_path, 'wb') as f:
78
- f.write(gif_bytes)
79
 
80
  return temp_gif_path
81
 
 
2
  import clip
3
  import torch
4
  import numpy as np
5
+ import tempfile
6
  import models.vqvae as vqvae
7
  import options.option_transformer as option_trans
8
  from utils.motion_process import recover_from_ric
 
74
  gif_bytes = draw_to_batch([motion_data], [text], None)
75
 
76
  # Save the GIF to a temporary file
77
+ with tempfile.NamedTemporaryFile(suffix=".gif", delete=False) as temp_gif_file:
78
+ temp_gif_file.write(gif_bytes)
79
+ temp_gif_path = temp_gif_file.name
80
 
81
  return temp_gif_path
82