Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ SLIDER_MIN_H, SLIDER_MAX_H = 128, 896
|
|
36 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, 896
|
37 |
MAX_SEED = np.iinfo(np.int32).max
|
38 |
|
39 |
-
FIXED_FPS =
|
40 |
MIN_FRAMES_MODEL = 8
|
41 |
MAX_FRAMES_MODEL = 81
|
42 |
|
@@ -79,17 +79,16 @@ def handle_image_upload_for_dims_wan(uploaded_pil_image, current_h_val, current_
|
|
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 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
else:
|
92 |
-
return 60
|
93 |
|
94 |
@spaces.GPU(duration=get_duration)
|
95 |
def generate_video(input_image, prompt, height, width,
|
@@ -125,7 +124,7 @@ def generate_video(input_image, prompt, height, width,
|
|
125 |
|
126 |
with gr.Blocks() as demo:
|
127 |
gr.Markdown("# Fast 4 steps Wan 2.1 I2V (14B) with CausVid LoRA")
|
128 |
-
gr.Markdown("[CausVid](https://github.com/tianweiy/CausVid) is a distilled version of Wan 2.1 to run faster in just 4-8 steps, [extracted as LoRA by Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_14B_T2V_lora_rank32.safetensors) and is compatible with 🧨 diffusers")
|
129 |
with gr.Row():
|
130 |
with gr.Column():
|
131 |
input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
|
|
|
36 |
SLIDER_MIN_W, SLIDER_MAX_W = 128, 896
|
37 |
MAX_SEED = np.iinfo(np.int32).max
|
38 |
|
39 |
+
FIXED_FPS = 60
|
40 |
MIN_FRAMES_MODEL = 8
|
41 |
MAX_FRAMES_MODEL = 81
|
42 |
|
|
|
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 |
+
# --- Эта функция изменена: убрано ограничение на 3 секунды ---
|
83 |
def get_duration(input_image, prompt, height, width,
|
84 |
+
negative_prompt, duration_seconds,
|
85 |
+
guidance_scale, steps,
|
86 |
+
seed, randomize_seed,
|
87 |
+
progress):
|
88 |
+
# Простая оценка времени выполнения: шаги × кадры × коэффициент
|
89 |
+
num_frames = int(round(duration_seconds * FIXED_FPS))
|
90 |
+
estimated_time = steps * num_frames * 0.2 # ~0.2 секунды на кадр/шаг
|
91 |
+
return max(10, int(estimated_time)) # Минимум 10 секунд для стабильности
|
|
|
|
|
92 |
|
93 |
@spaces.GPU(duration=get_duration)
|
94 |
def generate_video(input_image, prompt, height, width,
|
|
|
124 |
|
125 |
with gr.Blocks() as demo:
|
126 |
gr.Markdown("# Fast 4 steps Wan 2.1 I2V (14B) with CausVid LoRA")
|
127 |
+
gr.Markdown("[CausVid](https://github.com/tianweiy/CausVid ) is a distilled version of Wan 2.1 to run faster in just 4-8 steps, [extracted as LoRA by Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_14B_T2V_lora_rank32.safetensors ) and is compatible with 🧨 diffusers")
|
128 |
with gr.Row():
|
129 |
with gr.Column():
|
130 |
input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
|