multimodalart HF staff commited on
Commit
4254e9c
1 Parent(s): af7f787

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -65,7 +65,7 @@ model = load_model()
65
 
66
  # Text-to-video generation function
67
  @spaces.GPU(duration=120)
68
- def generate_video(image, prompt, duration, guidance_scale, video_guidance_scale, progress=gr.Progress(track_tqdm=True)):
69
  multiplier = 0.8 if is_canonical else 2.4
70
  temp = int(duration * 0.8) # Convert seconds to temp value (assuming 24 FPS)
71
  torch_dtype = torch.bfloat16 if MODEL_DTYPE == "bf16" else torch.float32
@@ -129,7 +129,8 @@ def generate_video(image, prompt, duration, guidance_scale, video_guidance_scale
129
 
130
  # Gradio interface
131
  with gr.Blocks() as demo:
132
- gr.Markdown("# Pyramid Flow text-to-video demo")
 
133
  gr.Markdown("[[Paper](https://arxiv.org/pdf/2410.05954)], [[Model](https://huggingface.co/rain1011/pyramid-flow-sd3)], [[Code](https://github.com/jy0205/Pyramid-Flow)]")
134
 
135
  #with gr.Tab("Text-to-Video"):
@@ -155,9 +156,19 @@ with gr.Blocks() as demo:
155
  <p>to use privately and generate videos up to 10s</p>
156
  </div>
157
  """)
 
 
 
 
 
 
 
 
 
 
158
  t2v_generate_btn.click(
159
  generate_video,
160
- inputs=[i2v_image, t2v_prompt, t2v_duration, t2v_guidance_scale, t2v_video_guidance_scale],
161
  outputs=t2v_output
162
  )
163
 
 
65
 
66
  # Text-to-video generation function
67
  @spaces.GPU(duration=120)
68
+ def generate_video(prompt, image=None, duration=5, guidance_scale=9, video_guidance_scale=5, progress=gr.Progress(track_tqdm=True)):
69
  multiplier = 0.8 if is_canonical else 2.4
70
  temp = int(duration * 0.8) # Convert seconds to temp value (assuming 24 FPS)
71
  torch_dtype = torch.bfloat16 if MODEL_DTYPE == "bf16" else torch.float32
 
129
 
130
  # Gradio interface
131
  with gr.Blocks() as demo:
132
+ gr.Markdown("# Pyramid Flow")
133
+ gr.Markdown("Pyramid Flow is a training-efficient Autoregressive Video Generation model based on Flow Matching. It is trained only on open-source datasets within 20.7k A100 GPU hours")
134
  gr.Markdown("[[Paper](https://arxiv.org/pdf/2410.05954)], [[Model](https://huggingface.co/rain1011/pyramid-flow-sd3)], [[Code](https://github.com/jy0205/Pyramid-Flow)]")
135
 
136
  #with gr.Tab("Text-to-Video"):
 
156
  <p>to use privately and generate videos up to 10s</p>
157
  </div>
158
  """)
159
+ gr.Examples(
160
+ examples=[
161
+ "A movie trailer featuring the adventures of the 30 year old space man wearing a red wool knitted motorcycle helmet, blue sky, salt desert, cinematic style, shot on 35mm film, vivid colors",
162
+ "Beautiful, snowy Tokyo city is bustling. The camera moves through the bustling city street, following several people enjoying the beautiful snowy weather and shopping at nearby stalls. Gorgeous sakura petals are flying through the wind along with snowflakes"
163
+ ]
164
+ fn=generate_video,
165
+ inputs=prompt,
166
+ ouutputs=t2v_output,
167
+ cache_examples="lazy"
168
+ )
169
  t2v_generate_btn.click(
170
  generate_video,
171
+ inputs=[t2v_prompt, i2v_image, t2v_duration, t2v_guidance_scale, t2v_video_guidance_scale],
172
  outputs=t2v_output
173
  )
174