Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files
app.py
CHANGED
@@ -33,6 +33,7 @@ pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, times
|
|
33 |
def generate_image(prompt, base, motion, step):
|
34 |
global step_loaded
|
35 |
global base_loaded
|
|
|
36 |
print(prompt, base, step)
|
37 |
|
38 |
if step_loaded != step:
|
@@ -47,8 +48,9 @@ def generate_image(prompt, base, motion, step):
|
|
47 |
|
48 |
if motion_loaded != motion:
|
49 |
pipe.unload_lora_weights()
|
50 |
-
|
51 |
-
|
|
|
52 |
motion_loaded = motion
|
53 |
|
54 |
output = pipe(prompt=prompt, guidance_scale=1.0, num_inference_steps=step)
|
@@ -80,11 +82,11 @@ with gr.Blocks(css="style.css") as demo:
|
|
80 |
select_motion = gr.Dropdown(
|
81 |
label='Motion LoRAs',
|
82 |
choices=[
|
83 |
-
("None",
|
84 |
("Zoom in", "v2_lora_ZoomIn.ckpt"),
|
85 |
("Zoom out", "v2_lora_ZoomOut.ckpt"),
|
86 |
],
|
87 |
-
value=
|
88 |
interactive=True
|
89 |
)
|
90 |
select_step = gr.Dropdown(
|
|
|
33 |
def generate_image(prompt, base, motion, step):
|
34 |
global step_loaded
|
35 |
global base_loaded
|
36 |
+
global motion_loaded
|
37 |
print(prompt, base, step)
|
38 |
|
39 |
if step_loaded != step:
|
|
|
48 |
|
49 |
if motion_loaded != motion:
|
50 |
pipe.unload_lora_weights()
|
51 |
+
if motion != "":
|
52 |
+
pipe.load_lora_weights(hf_hub_download("guoyww/animatediff", motion), adapter_name="motion")
|
53 |
+
pipe.set_adapters(["motion"], [0.7])
|
54 |
motion_loaded = motion
|
55 |
|
56 |
output = pipe(prompt=prompt, guidance_scale=1.0, num_inference_steps=step)
|
|
|
82 |
select_motion = gr.Dropdown(
|
83 |
label='Motion LoRAs',
|
84 |
choices=[
|
85 |
+
("None", ""),
|
86 |
("Zoom in", "v2_lora_ZoomIn.ckpt"),
|
87 |
("Zoom out", "v2_lora_ZoomOut.ckpt"),
|
88 |
],
|
89 |
+
value="",
|
90 |
interactive=True
|
91 |
)
|
92 |
select_step = gr.Dropdown(
|