alex
commited on
Commit
·
743929c
1
Parent(s):
1ca0b58
sanity check
Browse files
app.py
CHANGED
|
@@ -133,6 +133,45 @@ def resize_for_model(image_path):
|
|
| 133 |
)
|
| 134 |
return new_img, target_size
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
def get_duration(
|
| 137 |
text_prompt,
|
| 138 |
image,
|
|
@@ -343,7 +382,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 343 |
)
|
| 344 |
|
| 345 |
run_btn.click(
|
| 346 |
-
fn=
|
| 347 |
inputs=[video_text_prompt, image, sample_steps, session_state],
|
| 348 |
outputs=[output_path],
|
| 349 |
)
|
|
|
|
| 133 |
)
|
| 134 |
return new_img, target_size
|
| 135 |
|
| 136 |
+
def generate_scene(
|
| 137 |
+
text_prompt,
|
| 138 |
+
image,
|
| 139 |
+
sample_steps = 50,
|
| 140 |
+
session_id = None,
|
| 141 |
+
video_seed = 100,
|
| 142 |
+
solver_name = "unipc",
|
| 143 |
+
shift = 5,
|
| 144 |
+
video_guidance_scale = 4,
|
| 145 |
+
audio_guidance_scale = 3,
|
| 146 |
+
slg_layer = 11,
|
| 147 |
+
video_negative_prompt = "",
|
| 148 |
+
audio_negative_prompt = "",
|
| 149 |
+
progress=gr.Progress(track_tqdm=True)
|
| 150 |
+
):
|
| 151 |
+
text_prompt_processed = (text_prompt or "").strip()
|
| 152 |
+
|
| 153 |
+
if not image:
|
| 154 |
+
raise gr.Error("Please provide an image")
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
if not text_prompt_processed:
|
| 158 |
+
raise gr.Error("Please enter a prompt.")
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
return generate_video(text_prompt,
|
| 162 |
+
image,
|
| 163 |
+
sample_steps,
|
| 164 |
+
session_id,
|
| 165 |
+
video_seed,
|
| 166 |
+
solver_name,
|
| 167 |
+
shift,
|
| 168 |
+
video_guidance_scale,
|
| 169 |
+
audio_guidance_scale,
|
| 170 |
+
slg_layer,
|
| 171 |
+
video_negative_prompt,
|
| 172 |
+
audio_negative_prompt,
|
| 173 |
+
progress)
|
| 174 |
+
|
| 175 |
def get_duration(
|
| 176 |
text_prompt,
|
| 177 |
image,
|
|
|
|
| 382 |
)
|
| 383 |
|
| 384 |
run_btn.click(
|
| 385 |
+
fn=generate_scene,
|
| 386 |
inputs=[video_text_prompt, image, sample_steps, session_state],
|
| 387 |
outputs=[output_path],
|
| 388 |
)
|