Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,7 @@ pipe.to("cuda")
|
|
25 |
causvid_path = hf_hub_download(repo_id=LORA_REPO_ID, filename=LORA_FILENAME)
|
26 |
pipe.load_lora_weights(causvid_path, adapter_name="causvid_lora")
|
27 |
pipe.set_adapters(["causvid_lora"], adapter_weights=[0.95])
|
|
|
28 |
|
29 |
MOD_VALUE = 32
|
30 |
DEFAULT_H_SLIDER_VALUE = 512
|
@@ -78,7 +79,19 @@ def handle_image_upload_for_dims_wan(uploaded_pil_image, current_h_val, current_
|
|
78 |
gr.Warning("Error attempting to calculate new dimensions")
|
79 |
return gr.update(value=DEFAULT_H_SLIDER_VALUE), gr.update(value=DEFAULT_W_SLIDER_VALUE)
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
def generate_video(input_image, prompt, height, width,
|
83 |
negative_prompt=default_negative_prompt, duration_seconds = 2,
|
84 |
guidance_scale = 1, steps = 4,
|
|
|
25 |
causvid_path = hf_hub_download(repo_id=LORA_REPO_ID, filename=LORA_FILENAME)
|
26 |
pipe.load_lora_weights(causvid_path, adapter_name="causvid_lora")
|
27 |
pipe.set_adapters(["causvid_lora"], adapter_weights=[0.95])
|
28 |
+
pipe.fuse_lora()
|
29 |
|
30 |
MOD_VALUE = 32
|
31 |
DEFAULT_H_SLIDER_VALUE = 512
|
|
|
79 |
gr.Warning("Error attempting to calculate new dimensions")
|
80 |
return gr.update(value=DEFAULT_H_SLIDER_VALUE), gr.update(value=DEFAULT_W_SLIDER_VALUE)
|
81 |
|
82 |
+
def get_duration(input_image, prompt, height, width,
|
83 |
+
negative_prompt=default_negative_prompt, duration_seconds = 2,
|
84 |
+
guidance_scale = 1, steps = 4,
|
85 |
+
seed = 42, randomize_seed = False,
|
86 |
+
progress=gr.Progress(track_tqdm=True)):
|
87 |
+
if steps > 4 and duration_seconds > 2:
|
88 |
+
return 90
|
89 |
+
elif steps > 4 or duration_seconds > 2:
|
90 |
+
return 75
|
91 |
+
else:
|
92 |
+
return 60
|
93 |
+
|
94 |
+
@spaces.GPU(duration=get_duration)
|
95 |
def generate_video(input_image, prompt, height, width,
|
96 |
negative_prompt=default_negative_prompt, duration_seconds = 2,
|
97 |
guidance_scale = 1, steps = 4,
|