benibraz commited on
Commit
24ebbe7
1 Parent(s): a4b5a95

Add frame rate option to video generation functions and update UI labels

Browse files
Files changed (1) hide show
  1. app.py +28 -6
app.py CHANGED
@@ -170,13 +170,13 @@ pipeline = XoraVideoPipeline(
170
  def generate_video_from_text(
171
  prompt="",
172
  negative_prompt="",
 
173
  seed=171198,
174
  num_inference_steps=40,
175
  guidance_scale=3,
176
  height=512,
177
  width=768,
178
  num_frames=121,
179
- frame_rate=25,
180
  progress=gr.Progress(),
181
  ):
182
  if len(prompt.strip()) < 50:
@@ -235,13 +235,13 @@ def generate_video_from_image(
235
  image_path,
236
  prompt="",
237
  negative_prompt="",
 
238
  seed=171198,
239
  num_inference_steps=40,
240
  guidance_scale=3,
241
  height=512,
242
  width=768,
243
  num_frames=121,
244
- frame_rate=25,
245
  progress=gr.Progress(),
246
  ):
247
  if len(prompt.strip()) < 50:
@@ -416,7 +416,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
416
  txt2vid_preset = gr.Dropdown(
417
  choices=[p["label"] for p in preset_options],
418
  value="768x512, 97 frames",
419
- label="Step 3: Choose Resolution Preset",
 
 
 
 
 
 
 
 
420
  )
421
 
422
  txt2vid_advanced = create_advanced_options()
@@ -476,8 +484,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
476
 
477
  img2vid_preset = gr.Dropdown(
478
  choices=[p["label"] for p in preset_options],
479
- value="1216x704, 41 frames",
480
- label="Step 4: Choose Resolution Preset",
 
 
 
 
 
 
 
 
481
  )
482
 
483
  img2vid_advanced = create_advanced_options()
@@ -526,7 +542,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
526
 
527
  txt2vid_generate.click(
528
  fn=generate_video_from_text,
529
- inputs=[txt2vid_prompt, txt2vid_negative_prompt, *txt2vid_advanced],
 
 
 
 
 
530
  outputs=txt2vid_output,
531
  concurrency_limit=1,
532
  )
@@ -541,6 +562,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
541
  img2vid_image,
542
  img2vid_prompt,
543
  img2vid_negative_prompt,
 
544
  *img2vid_advanced,
545
  ],
546
  outputs=img2vid_output,
 
170
  def generate_video_from_text(
171
  prompt="",
172
  negative_prompt="",
173
+ frame_rate=25,
174
  seed=171198,
175
  num_inference_steps=40,
176
  guidance_scale=3,
177
  height=512,
178
  width=768,
179
  num_frames=121,
 
180
  progress=gr.Progress(),
181
  ):
182
  if len(prompt.strip()) < 50:
 
235
  image_path,
236
  prompt="",
237
  negative_prompt="",
238
+ frame_rate=25,
239
  seed=171198,
240
  num_inference_steps=40,
241
  guidance_scale=3,
242
  height=512,
243
  width=768,
244
  num_frames=121,
 
245
  progress=gr.Progress(),
246
  ):
247
  if len(prompt.strip()) < 50:
 
416
  txt2vid_preset = gr.Dropdown(
417
  choices=[p["label"] for p in preset_options],
418
  value="768x512, 97 frames",
419
+ label="Step 3.1: Choose Resolution Preset",
420
+ )
421
+
422
+ txt2vid_frame_rate = gr.Slider(
423
+ label="Step 3.2: Frame Rate",
424
+ minimum=21,
425
+ maximum=30,
426
+ step=1,
427
+ value=25,
428
  )
429
 
430
  txt2vid_advanced = create_advanced_options()
 
484
 
485
  img2vid_preset = gr.Dropdown(
486
  choices=[p["label"] for p in preset_options],
487
+ value="768x512, 97 frames",
488
+ label="Step 3.1: Choose Resolution Preset",
489
+ )
490
+
491
+ img2vid_frame_rate = gr.Slider(
492
+ label="Step 3.2: Frame Rate",
493
+ minimum=21,
494
+ maximum=30,
495
+ step=1,
496
+ value=25,
497
  )
498
 
499
  img2vid_advanced = create_advanced_options()
 
542
 
543
  txt2vid_generate.click(
544
  fn=generate_video_from_text,
545
+ inputs=[
546
+ txt2vid_prompt,
547
+ txt2vid_negative_prompt,
548
+ txt2vid_frame_rate,
549
+ *txt2vid_advanced,
550
+ ],
551
  outputs=txt2vid_output,
552
  concurrency_limit=1,
553
  )
 
562
  img2vid_image,
563
  img2vid_prompt,
564
  img2vid_negative_prompt,
565
+ img2vid_frame_rate,
566
  *img2vid_advanced,
567
  ],
568
  outputs=img2vid_output,