multimodalart HF staff commited on
Commit
a40b1c7
1 Parent(s): 12e9e51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -66,8 +66,8 @@ model = load_model()
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
72
  if(image):
73
  cropped_image = center_crop(image, 1280, 720)
@@ -98,7 +98,7 @@ def generate_video(prompt, image=None, duration=5, guidance_scale=9, video_guida
98
  save_memory=True,
99
  )
100
  output_path = f"{str(uuid.uuid4())}_output_video.mp4"
101
- export_to_video(frames, output_path, fps=8 if is_canonical else 24)
102
  return output_path
103
 
104
  # Gradio interface
@@ -113,7 +113,7 @@ with gr.Blocks() as demo:
113
  i2v_image = gr.Image(type="pil", label="Input Image")
114
  t2v_prompt = gr.Textbox(label="Prompt")
115
  with gr.Accordion("Advanced settings", open=False):
116
- t2v_duration = gr.Slider(minimum=1, maximum=10, value=5, step=1, label="Duration (seconds)", visible=not is_canonical)
117
  t2v_guidance_scale = gr.Slider(minimum=1, maximum=15, value=9, step=0.1, label="Guidance Scale")
118
  t2v_video_guidance_scale = gr.Slider(minimum=1, maximum=15, value=5, step=0.1, label="Video Guidance Scale")
119
  t2v_generate_btn = gr.Button("Generate Video")
 
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 = 1.2 if is_canonical else 3.0
70
+ temp = int(duration * multiplier) + 1
71
  torch_dtype = torch.bfloat16 if MODEL_DTYPE == "bf16" else torch.float32
72
  if(image):
73
  cropped_image = center_crop(image, 1280, 720)
 
98
  save_memory=True,
99
  )
100
  output_path = f"{str(uuid.uuid4())}_output_video.mp4"
101
+ export_to_video(frames, output_path, fps=24)
102
  return output_path
103
 
104
  # Gradio interface
 
113
  i2v_image = gr.Image(type="pil", label="Input Image")
114
  t2v_prompt = gr.Textbox(label="Prompt")
115
  with gr.Accordion("Advanced settings", open=False):
116
+ t2v_duration = gr.Slider(minimum=1, maximum=10, value=2 if is_canonical else 5, step=1, label="Duration (seconds)", visible=not is_canonical)
117
  t2v_guidance_scale = gr.Slider(minimum=1, maximum=15, value=9, step=0.1, label="Guidance Scale")
118
  t2v_video_guidance_scale = gr.Slider(minimum=1, maximum=15, value=5, step=0.1, label="Video Guidance Scale")
119
  t2v_generate_btn = gr.Button("Generate Video")