Lemonator commited on
Commit
5117d6d
·
verified ·
1 Parent(s): 9b68a67

Update app_lora.py

Browse files
Files changed (1) hide show
  1. app_lora.py +18 -11
app_lora.py CHANGED
@@ -48,8 +48,8 @@ SLIDER_MIN_W, SLIDER_MAX_W = 128, 1024
48
  MAX_SEED = np.iinfo(np.int32).max
49
 
50
  FIXED_FPS = 24
51
- MIN_FRAMES_MODEL = 8
52
- MAX_FRAMES_MODEL = 81
53
 
54
  default_prompt_i2v = "make this image come alive, cinematic motion, smooth animation"
55
  default_negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards, watermark, text, signature"
@@ -91,14 +91,15 @@ def handle_image_upload_for_dims_wan(uploaded_pil_image, current_h_val, current_
91
  return gr.update(value=DEFAULT_H_SLIDER_VALUE), gr.update(value=DEFAULT_W_SLIDER_VALUE)
92
 
93
  def get_duration(input_image, prompt, height, width,
94
- negative_prompt, duration_seconds,
95
- guidance_scale, steps,
96
- seed, randomize_seed,
97
- progress):
98
- if steps > 4 and duration_seconds > 2:
 
 
 
99
  return 90
100
- elif steps > 4 or duration_seconds > 2:
101
- return 75
102
  else:
103
  return 60
104
 
@@ -141,8 +142,14 @@ with gr.Blocks() as demo:
141
  with gr.Column():
142
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
143
  prompt_input = gr.Textbox(label="Prompt", value=default_prompt_i2v)
144
- duration_seconds_input = gr.Slider(minimum=round(MIN_FRAMES_MODEL/FIXED_FPS,1), maximum=round(MAX_FRAMES_MODEL/FIXED_FPS,1), step=0.1, value=2, label="Duration (seconds)", info=f"Clamped to model's {MIN_FRAMES_MODEL}-{MAX_FRAMES_MODEL} frames at {FIXED_FPS}fps.")
145
-
 
 
 
 
 
 
146
  with gr.Accordion("Advanced Settings", open=False):
147
  negative_prompt_input = gr.Textbox(label="Negative Prompt", value=default_negative_prompt, lines=3)
148
  seed_input = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42, interactive=True)
 
48
  MAX_SEED = np.iinfo(np.int32).max
49
 
50
  FIXED_FPS = 24
51
+ MIN_FRAMES_MODEL = 8 # Minimum 8 frames (~0.33s)
52
+ MAX_FRAMES_MODEL = 240 # Changed from 81 to 240 (10 seconds at 24fps)
53
 
54
  default_prompt_i2v = "make this image come alive, cinematic motion, smooth animation"
55
  default_negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards, watermark, text, signature"
 
91
  return gr.update(value=DEFAULT_H_SLIDER_VALUE), gr.update(value=DEFAULT_W_SLIDER_VALUE)
92
 
93
  def get_duration(input_image, prompt, height, width,
94
+ negative_prompt, duration_seconds,
95
+ guidance_scale, steps,
96
+ seed, randomize_seed,
97
+ progress):
98
+ # Longer timeout for longer videos
99
+ if steps > 4 and duration_seconds > 5: # Changed from 2 to 5
100
+ return 120 # Increased timeout for long generations
101
+ elif steps > 4 or duration_seconds > 5: # Changed from 2 to 5
102
  return 90
 
 
103
  else:
104
  return 60
105
 
 
142
  with gr.Column():
143
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
144
  prompt_input = gr.Textbox(label="Prompt", value=default_prompt_i2v)
145
+ duration_seconds_input = gr.Slider(
146
+ minimum=round(MIN_FRAMES_MODEL/FIXED_FPS,1), # 0.3s (8 frames)
147
+ maximum=round(MAX_FRAMES_MODEL/FIXED_FPS,1), # Now 10.0s (240 frames)
148
+ step=0.1,
149
+ value=3, # Changed default from 2 to 3 seconds
150
+ label="Duration (seconds)",
151
+ info=f"Clamped to {MIN_FRAMES_MODEL}-{MAX_FRAMES_MODEL} frames at {FIXED_FPS}fps (~{MIN_FRAMES_MODEL/FIXED_FPS:.1f}-{MAX_FRAMES_MODEL/FIXED_FPS:.1f}s)"
152
+ )
153
  with gr.Accordion("Advanced Settings", open=False):
154
  negative_prompt_input = gr.Textbox(label="Negative Prompt", value=default_negative_prompt, lines=3)
155
  seed_input = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42, interactive=True)