Maximofn commited on
Commit
ce24f93
·
verified ·
1 Parent(s): ad8dd98

Add example video loading functionality to Gradio interface

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -115,6 +115,13 @@ def generate_video(transformer_model, prompt, negative_prompt, num_frames, heigh
115
  print("Saving video")
116
  return save_video(video_frames)
117
 
 
 
 
 
 
 
 
118
  def create_interface():
119
  """Create and configure the Gradio interface"""
120
  with gr.Blocks() as demo:
@@ -216,6 +223,9 @@ def create_interface():
216
  width,
217
  num_inference_steps
218
  ],
 
 
 
219
  label="Prompt Examples"
220
  )
221
 
 
115
  print("Saving video")
116
  return save_video(video_frames)
117
 
118
+ def load_example_video(example_index):
119
+ """Carga un video de ejemplo desde la carpeta example_outputs"""
120
+ example_path = f"example_outputs/example_{example_index}.mp4"
121
+ if os.path.exists(example_path):
122
+ return example_path
123
+ return None
124
+
125
  def create_interface():
126
  """Create and configure the Gradio interface"""
127
  with gr.Blocks() as demo:
 
223
  width,
224
  num_inference_steps
225
  ],
226
+ outputs=video_output,
227
+ fn=load_example_video,
228
+ cache_examples=True,
229
  label="Prompt Examples"
230
  )
231