Mirror the generator's title, theme and advanced-options layout
Browse files
app.py
CHANGED
|
@@ -52,6 +52,7 @@ CANVASES = {
|
|
| 52 |
"544x960 · 9:16 fast": (960, 544),
|
| 53 |
"640x1152 · 9:16": (1152, 640),
|
| 54 |
"768x1344 · 9:16 full": (1344, 768),
|
|
|
|
| 55 |
"768x768 · 1:1 full": (768, 768),
|
| 56 |
"1024x768 · 4:3 full": (768, 1024),
|
| 57 |
"768x1024 · 3:4 full": (1024, 768),
|
|
@@ -311,15 +312,15 @@ def _generate(prompt_embeds, text_token_tags, references, height, width, num_fra
|
|
| 311 |
|
| 312 |
def generate(
|
| 313 |
prompt,
|
| 314 |
-
video_path,
|
| 315 |
-
first_image_path,
|
| 316 |
-
second_image_path,
|
| 317 |
-
audio_path,
|
| 318 |
-
canvas,
|
| 319 |
-
match,
|
| 320 |
-
duration,
|
| 321 |
-
steps,
|
| 322 |
-
seed,
|
| 323 |
progress=gr.Progress(track_tqdm=True),
|
| 324 |
):
|
| 325 |
if LOAD_ERROR:
|
|
@@ -372,11 +373,22 @@ def generate(
|
|
| 372 |
|
| 373 |
load_models()
|
| 374 |
|
| 375 |
-
INTRO = """# MiniMax-H3
|
| 376 |
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
"""
|
| 381 |
|
| 382 |
with gr.Blocks(title="MiniMax-H3 references") as demo:
|
|
@@ -400,14 +412,16 @@ with gr.Blocks(title="MiniMax-H3 references") as demo:
|
|
| 400 |
second_image = gr.Image(label="Subject, style or scene", type="filepath")
|
| 401 |
with gr.Tab("Audio"):
|
| 402 |
audio = gr.Audio(label="A voice or a piece of music", type="filepath")
|
| 403 |
-
canvas = gr.Dropdown(label="Canvas", choices=list(CANVASES), value=DEFAULT_CANVAS)
|
| 404 |
-
match = gr.Checkbox(label="Match the reference soundtrack", value=True, visible=False)
|
| 405 |
-
duration = gr.Slider(
|
| 406 |
-
label="Duration (s)", minimum=MIN_DURATION, maximum=MAX_UI_DURATION, step=1, value=5
|
| 407 |
-
)
|
| 408 |
-
steps = gr.Slider(label="Steps", minimum=10, maximum=40, step=1, value=28)
|
| 409 |
-
seed = gr.Number(label="Seed", value=42, precision=0)
|
| 410 |
run = gr.Button("Generate", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
with gr.Column():
|
| 412 |
result = gr.Video(label="Video + soundtrack")
|
| 413 |
|
|
@@ -426,4 +440,4 @@ with gr.Blocks(title="MiniMax-H3 references") as demo:
|
|
| 426 |
|
| 427 |
|
| 428 |
if __name__ == "__main__":
|
| 429 |
-
demo.
|
|
|
|
| 52 |
"544x960 · 9:16 fast": (960, 544),
|
| 53 |
"640x1152 · 9:16": (1152, 640),
|
| 54 |
"768x1344 · 9:16 full": (1344, 768),
|
| 55 |
+
"544x544 · 1:1 fast": (544, 544),
|
| 56 |
"768x768 · 1:1 full": (768, 768),
|
| 57 |
"1024x768 · 4:3 full": (768, 1024),
|
| 58 |
"768x1024 · 3:4 full": (1024, 768),
|
|
|
|
| 312 |
|
| 313 |
def generate(
|
| 314 |
prompt,
|
| 315 |
+
video_path=None,
|
| 316 |
+
first_image_path=None,
|
| 317 |
+
second_image_path=None,
|
| 318 |
+
audio_path=None,
|
| 319 |
+
canvas=DEFAULT_CANVAS,
|
| 320 |
+
match=True,
|
| 321 |
+
duration=5,
|
| 322 |
+
steps=28,
|
| 323 |
+
seed=42,
|
| 324 |
progress=gr.Progress(track_tqdm=True),
|
| 325 |
):
|
| 326 |
if LOAD_ERROR:
|
|
|
|
| 373 |
|
| 374 |
load_models()
|
| 375 |
|
| 376 |
+
INTRO = """# MiniMax-H3
|
| 377 |
|
| 378 |
+
<div align="center">
|
| 379 |
+
<a href="https://huggingface.co/MiniMaxAI/MiniMax-H3"><strong>[ model ]</strong></a>
|
| 380 |
+
<a href="PAPER_URL_PLACEHOLDER"><strong>[ paper ]</strong></a>
|
| 381 |
+
<a href="https://www.minimax.io"><strong>[ project ]</strong></a>
|
| 382 |
+
</div>
|
| 383 |
+
|
| 384 |
+
**MiniMax-H3** is a 33B parameter state of the art video generation model that produces video and a
|
| 385 |
+
fully synchronized soundtrack (ambience, foley, speech). Bring your own subject, camera move or voice as a
|
| 386 |
+
reference — they are read **in tab order**, video then images then audio.
|
| 387 |
+
"""
|
| 388 |
+
|
| 389 |
+
CSS = """
|
| 390 |
+
#col-container { max-width: 1180px; margin: 0 auto; }
|
| 391 |
+
.dark .gradio-container { color: var(--body-text-color); }
|
| 392 |
"""
|
| 393 |
|
| 394 |
with gr.Blocks(title="MiniMax-H3 references") as demo:
|
|
|
|
| 412 |
second_image = gr.Image(label="Subject, style or scene", type="filepath")
|
| 413 |
with gr.Tab("Audio"):
|
| 414 |
audio = gr.Audio(label="A voice or a piece of music", type="filepath")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
run = gr.Button("Generate", variant="primary")
|
| 416 |
+
with gr.Accordion("Advanced options", open=False):
|
| 417 |
+
canvas = gr.Dropdown(label="Canvas", choices=list(CANVASES), value=DEFAULT_CANVAS)
|
| 418 |
+
match = gr.Checkbox(label="Match the reference soundtrack", value=True, visible=False)
|
| 419 |
+
duration = gr.Slider(
|
| 420 |
+
label="Duration (s)", minimum=MIN_DURATION, maximum=MAX_UI_DURATION, step=1, value=5
|
| 421 |
+
)
|
| 422 |
+
steps = gr.Slider(label="Steps", minimum=10, maximum=40, step=1, value=28)
|
| 423 |
+
seed = gr.Number(label="Seed", value=42, precision=0)
|
| 424 |
+
|
| 425 |
with gr.Column():
|
| 426 |
result = gr.Video(label="Video + soundtrack")
|
| 427 |
|
|
|
|
| 440 |
|
| 441 |
|
| 442 |
if __name__ == "__main__":
|
| 443 |
+
demo.launch(show_error=True, theme=gr.themes.Citrus(), css=CSS)
|