Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 =
|
| 70 |
-
temp = int(duration *
|
| 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=
|
| 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")
|