nockhtu commited on
Commit
3bbbdbd
·
verified ·
1 Parent(s): 3f8b462

Expand duration extensions and quality options

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -41,6 +41,8 @@ QUALITY_PROFILES = {
41
  "Schnell · 480p · 4 Schritte": {"area": 480 * 832, "steps": 4, "seconds": 70},
42
  "Ausgewogen · 480p · 8 Schritte": {"area": 480 * 832, "steps": 8, "seconds": 110},
43
  "Qualität · 576p · 12 Schritte": {"area": 576 * 1024, "steps": 12, "seconds": 145},
 
 
44
  }
45
 
46
  ASPECT_RATIOS = {
@@ -145,7 +147,7 @@ def _to_pil_frame(frame) -> Image.Image:
145
 
146
  def _frame_count(duration_seconds: float) -> int:
147
  desired = int(round(float(duration_seconds) * FPS))
148
- return int(np.clip(round((desired - 1) / 4) * 4 + 1, 17, 81))
149
 
150
 
151
  def estimate_gpu_duration(
@@ -164,12 +166,13 @@ def estimate_gpu_duration(
164
  progress=None,
165
  ):
166
  del uploaded_image, image_prompt, motion_prompt, extension_prompt, aspect_ratio
167
- del clip_duration, negative_prompt, seed, randomize_seed, progress
168
  profile = QUALITY_PROFILES.get(quality, QUALITY_PROFILES["Ausgewogen · 480p · 8 Schritte"])
169
- total = profile["seconds"] * (int(extensions) + 1)
 
170
  if start_mode == "Text → Startbild → Video":
171
  total += 20
172
- return min(600, max(60, total))
173
 
174
 
175
  @spaces.GPU(duration=estimate_gpu_duration)
@@ -341,15 +344,20 @@ with gr.Blocks() as demo:
341
  label="Seitenverhältnis",
342
  )
343
  clip_duration = gr.Slider(
344
- 1.1, 5.0, value=2.1, step=0.1, label="Dauer pro Clip (Sekunden)"
 
 
 
 
 
345
  )
346
  extensions = gr.Slider(
347
  0,
348
- 3,
349
  value=1,
350
  step=1,
351
  label="Anzahl Verlängerungen",
352
- info="0 = ein Clip, 2 = drei Clips insgesamt",
353
  )
354
  with gr.Accordion("Erweiterte Einstellungen", open=False):
355
  negative_prompt = gr.Textbox(
 
41
  "Schnell · 480p · 4 Schritte": {"area": 480 * 832, "steps": 4, "seconds": 70},
42
  "Ausgewogen · 480p · 8 Schritte": {"area": 480 * 832, "steps": 8, "seconds": 110},
43
  "Qualität · 576p · 12 Schritte": {"area": 576 * 1024, "steps": 12, "seconds": 145},
44
+ "Sehr hoch · 720p · 16 Schritte": {"area": 720 * 1280, "steps": 16, "seconds": 300},
45
+ "Maximum · 720p · 24 Schritte": {"area": 720 * 1280, "steps": 24, "seconds": 450},
46
  }
47
 
48
  ASPECT_RATIOS = {
 
147
 
148
  def _frame_count(duration_seconds: float) -> int:
149
  desired = int(round(float(duration_seconds) * FPS))
150
+ return int(np.clip(round((desired - 1) / 4) * 4 + 1, 17, 161))
151
 
152
 
153
  def estimate_gpu_duration(
 
166
  progress=None,
167
  ):
168
  del uploaded_image, image_prompt, motion_prompt, extension_prompt, aspect_ratio
169
+ del negative_prompt, seed, randomize_seed, progress
170
  profile = QUALITY_PROFILES.get(quality, QUALITY_PROFILES["Ausgewogen · 480p · 8 Schritte"])
171
+ frame_factor = _frame_count(float(clip_duration)) / _frame_count(2.1)
172
+ total = profile["seconds"] * frame_factor * (int(extensions) + 1)
173
  if start_mode == "Text → Startbild → Video":
174
  total += 20
175
+ return min(3600, max(60, round(total)))
176
 
177
 
178
  @spaces.GPU(duration=estimate_gpu_duration)
 
344
  label="Seitenverhältnis",
345
  )
346
  clip_duration = gr.Slider(
347
+ 1.1,
348
+ 10.0,
349
+ value=2.1,
350
+ step=0.1,
351
+ label="Dauer pro Clip (Sekunden)",
352
+ info="Bis 5 Sekunden regulär; 5,1–10 Sekunden experimenteller Langclip-Modus.",
353
  )
354
  extensions = gr.Slider(
355
  0,
356
+ 5,
357
  value=1,
358
  step=1,
359
  label="Anzahl Verlängerungen",
360
+ info="0 = ein Clip, 5 = sechs Clips insgesamt",
361
  )
362
  with gr.Accordion("Erweiterte Einstellungen", open=False):
363
  negative_prompt = gr.Textbox(