multimodalart HF Staff commited on
Commit
1aa28b5
·
verified ·
1 Parent(s): 6237c6a

Fast canvas stays the default; the examples carry full-resolution canvases

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -62,9 +62,10 @@ CANVASES = {
62
  "768x1024 · 3:4 full": (1024, 768),
63
  "1536x672 · 21:9 full": (672, 1536),
64
  }
65
- # The full 16:9 canvas, not the fast one. `gr.Examples` are cached lazily and generated once, so what an example
66
- # is worth is its quality rather than its latency; the fast canvases stay in the dropdown for interactive use.
67
- DEFAULT_CANVAS = "1344x768 · 16:9 full"
 
68
  FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
69
  # 15 s is the checkpoint's ceiling, but it is the *snapped* frame count that has to hold for it: 15 s is 360 frames,
70
  # which rounds up to 362, i.e. 15.083 s, and is refused. 14 is the last whole second that survives the snap.
@@ -450,6 +451,7 @@ def generate(
450
  image_1=None,
451
  audio_path=None,
452
  video_path=None,
 
453
  image_2=None,
454
  image_3=None,
455
  image_4=None,
@@ -458,7 +460,6 @@ def generate(
458
  image_7=None,
459
  image_8=None,
460
  image_9=None,
461
- canvas=DEFAULT_CANVAS,
462
  match=True,
463
  duration=5,
464
  steps=28,
@@ -604,8 +605,8 @@ with gr.Blocks(title="MiniMax-H3 Reference") as demo:
604
  duration_controls, [audio, video, match], [match, duration], show_progress="hidden", api_name=False
605
  )
606
 
607
- # Same order as `generate`'s signature: the exampled four first, then the remaining image slots.
608
- request = [prompt, images[0], audio, video, *images[1:], canvas, match, duration, steps, seed]
609
 
610
  gr.Examples(
611
  examples=[
@@ -614,21 +615,24 @@ with gr.Blocks(title="MiniMax-H3 Reference") as demo:
614
  "examples/subject.png",
615
  None,
616
  None,
 
617
  ],
618
  [
619
  "The character speaks to camera in a quiet room, lips matching every word",
620
  "examples/subject.png",
621
  "examples/voice.wav",
622
  None,
 
623
  ],
624
  [
625
  "The character moves with the same camera push, down a rainy alley at night",
626
  "examples/subject.png",
627
  None,
628
  "examples/motion.mp4",
 
629
  ],
630
  ],
631
- inputs=[prompt, images[0], audio, video],
632
  outputs=result,
633
  fn=generate,
634
  cache_examples=True,
 
62
  "768x1024 · 3:4 full": (1024, 768),
63
  "1536x672 · 21:9 full": (672, 1536),
64
  }
65
+ DEFAULT_CANVAS = "960x544 · 16:9 fast"
66
+ # The examples carry their own canvas, and it is a full one. They are cached lazily and generated once, so what an
67
+ # example is worth is its quality rather than its latency; an interactive request starts on the fast canvas.
68
+ EXAMPLE_CANVAS, EXAMPLE_PORTRAIT_CANVAS = "1344x768 · 16:9 full", "768x1024 · 3:4 full"
69
  FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
70
  # 15 s is the checkpoint's ceiling, but it is the *snapped* frame count that has to hold for it: 15 s is 360 frames,
71
  # which rounds up to 362, i.e. 15.083 s, and is refused. 14 is the last whole second that survives the snap.
 
451
  image_1=None,
452
  audio_path=None,
453
  video_path=None,
454
+ canvas=DEFAULT_CANVAS,
455
  image_2=None,
456
  image_3=None,
457
  image_4=None,
 
460
  image_7=None,
461
  image_8=None,
462
  image_9=None,
 
463
  match=True,
464
  duration=5,
465
  steps=28,
 
605
  duration_controls, [audio, video, match], [match, duration], show_progress="hidden", api_name=False
606
  )
607
 
608
+ # Same order as `generate`'s signature: the exampled five first, then the remaining image slots.
609
+ request = [prompt, images[0], audio, video, canvas, *images[1:], match, duration, steps, seed]
610
 
611
  gr.Examples(
612
  examples=[
 
615
  "examples/subject.png",
616
  None,
617
  None,
618
+ EXAMPLE_CANVAS,
619
  ],
620
  [
621
  "The character speaks to camera in a quiet room, lips matching every word",
622
  "examples/subject.png",
623
  "examples/voice.wav",
624
  None,
625
+ EXAMPLE_PORTRAIT_CANVAS,
626
  ],
627
  [
628
  "The character moves with the same camera push, down a rainy alley at night",
629
  "examples/subject.png",
630
  None,
631
  "examples/motion.mp4",
632
+ EXAMPLE_CANVAS,
633
  ],
634
  ],
635
+ inputs=[prompt, images[0], audio, video, canvas],
636
  outputs=result,
637
  fn=generate,
638
  cache_examples=True,