Spaces:
Running on Zero
Running on Zero
Upload app.py
Browse files
app.py
CHANGED
|
@@ -58,7 +58,6 @@ CANVASES = {
|
|
| 58 |
"1536x672 路 21:9 full": (672, 1536),
|
| 59 |
}
|
| 60 |
DEFAULT_CANVAS = "960x544 路 16:9 fast"
|
| 61 |
-
EXAMPLE_CANVAS, EXAMPLE_PORTRAIT_CANVAS = "1344x768 路 16:9 full", "768x1024 路 3:4 full"
|
| 62 |
FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
|
| 63 |
# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.
|
| 64 |
# 15.083 s, and is refused. 14 is the last whole second that survives the snap.
|
|
@@ -533,9 +532,8 @@ def _generate(prompt_embeds, text_token_tags, references, height, width, num_fra
|
|
| 533 |
|
| 534 |
|
| 535 |
def generate(
|
| 536 |
-
#
|
| 537 |
-
#
|
| 538 |
-
# this at all, and `upsample` is last so a positional API client that predates it is unaffected.
|
| 539 |
prompt,
|
| 540 |
image_1=None,
|
| 541 |
audio_path=None,
|
|
@@ -755,43 +753,12 @@ with gr.Blocks(title="MiniMax-H3 Reference") as demo:
|
|
| 755 |
lora_inputs = [field for pair in zip(lora_references, lora_scales) for field in pair]
|
| 756 |
lora_upload.upload(_fill_lora_slots, [lora_upload, *lora_references], lora_references, api_name=False)
|
| 757 |
|
| 758 |
-
# Same order as `generate`'s signature: the
|
| 759 |
-
# fields the `*lora_fields` tail collects.
|
| 760 |
request = [
|
| 761 |
prompt, images[0], audio, video, canvas, *images[1:], match, duration, steps, seed, upsample, *lora_inputs
|
| 762 |
]
|
| 763 |
|
| 764 |
-
gr.Examples(
|
| 765 |
-
examples=[
|
| 766 |
-
[
|
| 767 |
-
"The character walks through a neon-lit street in the rain, humming to themselves",
|
| 768 |
-
"examples/subject.png",
|
| 769 |
-
None,
|
| 770 |
-
None,
|
| 771 |
-
EXAMPLE_CANVAS,
|
| 772 |
-
],
|
| 773 |
-
[
|
| 774 |
-
"The character speaks to camera in a quiet room, lips matching every word",
|
| 775 |
-
"examples/subject.png",
|
| 776 |
-
"examples/voice.wav",
|
| 777 |
-
None,
|
| 778 |
-
EXAMPLE_PORTRAIT_CANVAS,
|
| 779 |
-
],
|
| 780 |
-
[
|
| 781 |
-
"The character moves with the same camera push, down a rainy alley at night",
|
| 782 |
-
"examples/subject.png",
|
| 783 |
-
None,
|
| 784 |
-
"examples/motion.mp4",
|
| 785 |
-
EXAMPLE_CANVAS,
|
| 786 |
-
],
|
| 787 |
-
],
|
| 788 |
-
inputs=[prompt, images[0], audio, video, canvas],
|
| 789 |
-
outputs=[result, upsampled, upsampled_panel],
|
| 790 |
-
fn=generate,
|
| 791 |
-
cache_examples=True,
|
| 792 |
-
cache_mode="lazy",
|
| 793 |
-
)
|
| 794 |
-
|
| 795 |
run.click(generate, request, [result, upsampled, upsampled_panel], api_name="generate")
|
| 796 |
|
| 797 |
|
|
|
|
| 58 |
"1536x672 路 21:9 full": (672, 1536),
|
| 59 |
}
|
| 60 |
DEFAULT_CANVAS = "960x544 路 16:9 fast"
|
|
|
|
| 61 |
FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5
|
| 62 |
# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e.
|
| 63 |
# 15.083 s, and is refused. 14 is the last whole second that survives the snap.
|
|
|
|
| 532 |
|
| 533 |
|
| 534 |
def generate(
|
| 535 |
+
# Every parameter after `prompt` has a default, and the newest ones sit at the end, so a positional API client
|
| 536 |
+
# written against an older signature keeps working.
|
|
|
|
| 537 |
prompt,
|
| 538 |
image_1=None,
|
| 539 |
audio_path=None,
|
|
|
|
| 753 |
lora_inputs = [field for pair in zip(lora_references, lora_scales) for field in pair]
|
| 754 |
lora_upload.upload(_fill_lora_slots, [lora_upload, *lora_references], lora_references, api_name=False)
|
| 755 |
|
| 756 |
+
# Same order as `generate`'s signature: the five leading columns first, then the remaining image slots, then the
|
| 757 |
+
# LoRA fields the `*lora_fields` tail collects.
|
| 758 |
request = [
|
| 759 |
prompt, images[0], audio, video, canvas, *images[1:], match, duration, steps, seed, upsample, *lora_inputs
|
| 760 |
]
|
| 761 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
run.click(generate, request, [result, upsampled, upsampled_panel], api_name="generate")
|
| 763 |
|
| 764 |
|