Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- minimax/apps/gradio/state.py +3 -4
- minimax/apps/gradio/ui.py +38 -14
minimax/apps/gradio/state.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing import Any
|
|
| 8 |
|
| 9 |
from minimax.modeling.generate import generate_one
|
| 10 |
from minimax.modeling.loader import build_stop_ids, load_model_and_tokenizer
|
| 11 |
-
from minimax.paths import
|
| 12 |
|
| 13 |
|
| 14 |
def parse_assets(assets_text: str | None) -> list[str] | None:
|
|
@@ -106,7 +106,7 @@ class InferenceSession:
|
|
| 106 |
"""Holds one loaded model; reloads when the path changes."""
|
| 107 |
|
| 108 |
def __init__(self, default_model: str | Path | None = None) -> None:
|
| 109 |
-
self.default_model = str(default_model or
|
| 110 |
self._bundle: ModelBundle | None = None
|
| 111 |
|
| 112 |
@property
|
|
@@ -115,8 +115,7 @@ class InferenceSession:
|
|
| 115 |
|
| 116 |
def ensure_loaded(self, model_path: str | None = None) -> ModelBundle:
|
| 117 |
# Keep Hub repo ids as plain strings (do not Path()-normalize them).
|
| 118 |
-
|
| 119 |
-
path = str(raw)
|
| 120 |
if self._bundle is not None and self._bundle.path == path:
|
| 121 |
return self._bundle
|
| 122 |
model, tokenizer = load_model_and_tokenizer(path)
|
|
|
|
| 8 |
|
| 9 |
from minimax.modeling.generate import generate_one
|
| 10 |
from minimax.modeling.loader import build_stop_ids, load_model_and_tokenizer
|
| 11 |
+
from minimax.paths import CHAMPION_DIR
|
| 12 |
|
| 13 |
|
| 14 |
def parse_assets(assets_text: str | None) -> list[str] | None:
|
|
|
|
| 106 |
"""Holds one loaded model; reloads when the path changes."""
|
| 107 |
|
| 108 |
def __init__(self, default_model: str | Path | None = None) -> None:
|
| 109 |
+
self.default_model = str(default_model or CHAMPION_DIR)
|
| 110 |
self._bundle: ModelBundle | None = None
|
| 111 |
|
| 112 |
@property
|
|
|
|
| 115 |
|
| 116 |
def ensure_loaded(self, model_path: str | None = None) -> ModelBundle:
|
| 117 |
# Keep Hub repo ids as plain strings (do not Path()-normalize them).
|
| 118 |
+
path = str(model_path or self.default_model)
|
|
|
|
| 119 |
if self._bundle is not None and self._bundle.path == path:
|
| 120 |
return self._bundle
|
| 121 |
model, tokenizer = load_model_and_tokenizer(path)
|
minimax/apps/gradio/ui.py
CHANGED
|
@@ -347,7 +347,8 @@ def build_app(*, model_path: str | Path | None = None):
|
|
| 347 |
video prompts: shots, camera, soundscape, and score, following the official
|
| 348 |
structured format (not “cinematic 8k masterpiece” fluff).
|
| 349 |
|
| 350 |
-
Drop a rough idea
|
|
|
|
| 351 |
"""
|
| 352 |
)
|
| 353 |
|
|
@@ -368,22 +369,37 @@ Drop a rough idea (and optional references), set duration, hit **Generate**.
|
|
| 368 |
# so the user never picks a task code. Empty → plain text-to-video.
|
| 369 |
# Counts are capped to the H3 Ref2VA media limits (≤9 images,
|
| 370 |
# ≤2 videos, ≤2 audio, ≤12 total).
|
| 371 |
-
with gr.Accordion(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
detected = gr.Markdown(
|
| 373 |
"**Detected:** Text → video · `T2VA`", elem_classes=["gc-detected"]
|
| 374 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
first_frame = gr.Textbox(
|
| 376 |
-
label="First frame",
|
| 377 |
-
|
|
|
|
| 378 |
)
|
| 379 |
last_frame = gr.Textbox(
|
| 380 |
-
label="Last frame",
|
| 381 |
-
|
|
|
|
| 382 |
)
|
| 383 |
subject_refs = gr.Textbox(
|
| 384 |
-
label="Subject / look references",
|
| 385 |
lines=3,
|
| 386 |
-
info=
|
|
|
|
|
|
|
|
|
|
| 387 |
placeholder=(
|
| 388 |
"man in a red-and-blue spider-themed suit\n"
|
| 389 |
"woman with a silver bob and a leather jacket\n"
|
|
@@ -392,26 +408,34 @@ Drop a rough idea (and optional references), set duration, hit **Generate**.
|
|
| 392 |
),
|
| 393 |
)
|
| 394 |
keyframe = gr.Textbox(
|
| 395 |
-
label="Keyframe to hit",
|
|
|
|
| 396 |
placeholder="a steam train on an oil-painted cobblestone street",
|
| 397 |
)
|
| 398 |
continue_video = gr.Textbox(
|
| 399 |
-
label="Video to continue",
|
|
|
|
| 400 |
placeholder="panoramic golden beach at sunset, calm blue tide",
|
| 401 |
)
|
| 402 |
edit_footage = gr.Textbox(
|
| 403 |
-
label="Footage to edit",
|
| 404 |
lines=2,
|
| 405 |
-
info=
|
|
|
|
|
|
|
|
|
|
| 406 |
placeholder=(
|
| 407 |
"coffee-shop interior — brick wall, orange sofa, neon sign\n"
|
| 408 |
"young man in a dark-grey hoodie with a Samoyed"
|
| 409 |
),
|
| 410 |
)
|
| 411 |
audio_ref = gr.Textbox(
|
| 412 |
-
label="Audio reference",
|
| 413 |
lines=2,
|
| 414 |
-
info=
|
|
|
|
|
|
|
|
|
|
| 415 |
placeholder=(
|
| 416 |
"gentle waves and wind continuity (not a 1:1 copy)\n"
|
| 417 |
"distant seabird calls"
|
|
|
|
| 347 |
video prompts: shots, camera, soundscape, and score, following the official
|
| 348 |
structured format (not “cinematic 8k masterpiece” fluff).
|
| 349 |
|
| 350 |
+
Drop a rough idea, set duration, hit **Generate**. References below are **text
|
| 351 |
+
descriptions** of frames / clips / audio — not file uploads.
|
| 352 |
"""
|
| 353 |
)
|
| 354 |
|
|
|
|
| 369 |
# so the user never picks a task code. Empty → plain text-to-video.
|
| 370 |
# Counts are capped to the H3 Ref2VA media limits (≤9 images,
|
| 371 |
# ≤2 videos, ≤2 audio, ≤12 total).
|
| 372 |
+
with gr.Accordion(
|
| 373 |
+
"References & frames · describe only (no file upload)",
|
| 374 |
+
open=False,
|
| 375 |
+
elem_classes=["gc-decoding"],
|
| 376 |
+
):
|
| 377 |
detected = gr.Markdown(
|
| 378 |
"**Detected:** Text → video · `T2VA`", elem_classes=["gc-detected"]
|
| 379 |
)
|
| 380 |
+
gr.Markdown(
|
| 381 |
+
"Type a short **description** of what is in each reference "
|
| 382 |
+
"(what the picture/video/audio *looks or sounds like*). "
|
| 383 |
+
"Do **not** attach media files here — the model never sees "
|
| 384 |
+
"pixels or waveforms, only your words."
|
| 385 |
+
)
|
| 386 |
first_frame = gr.Textbox(
|
| 387 |
+
label="First frame · describe",
|
| 388 |
+
info="Words for the opening image, e.g. subject, pose, lighting, setting.",
|
| 389 |
+
placeholder="young woman by a rainy train window at night, dark coat, folded letter",
|
| 390 |
)
|
| 391 |
last_frame = gr.Textbox(
|
| 392 |
+
label="Last frame · optional · describe",
|
| 393 |
+
info="Words for the ending image when you want a first→last path.",
|
| 394 |
+
placeholder="cyclist paused at a stone bridge, mist clearing",
|
| 395 |
)
|
| 396 |
subject_refs = gr.Textbox(
|
| 397 |
+
label="Subject / look references · describe",
|
| 398 |
lines=3,
|
| 399 |
+
info=(
|
| 400 |
+
f"Describe each subject or look (one per line), up to "
|
| 401 |
+
f"{REF_LIMITS['image']} — text only, not image files."
|
| 402 |
+
),
|
| 403 |
placeholder=(
|
| 404 |
"man in a red-and-blue spider-themed suit\n"
|
| 405 |
"woman with a silver bob and a leather jacket\n"
|
|
|
|
| 408 |
),
|
| 409 |
)
|
| 410 |
keyframe = gr.Textbox(
|
| 411 |
+
label="Keyframe to hit · describe",
|
| 412 |
+
info="Describe the frame you want the clip to land on.",
|
| 413 |
placeholder="a steam train on an oil-painted cobblestone street",
|
| 414 |
)
|
| 415 |
continue_video = gr.Textbox(
|
| 416 |
+
label="Video to continue · describe",
|
| 417 |
+
info="Describe the ending of the source clip to continue from.",
|
| 418 |
placeholder="panoramic golden beach at sunset, calm blue tide",
|
| 419 |
)
|
| 420 |
edit_footage = gr.Textbox(
|
| 421 |
+
label="Footage to edit · describe",
|
| 422 |
lines=2,
|
| 423 |
+
info=(
|
| 424 |
+
f"Describe each clip/scene to edit (one per line), up to "
|
| 425 |
+
f"{REF_LIMITS['video']} — text only."
|
| 426 |
+
),
|
| 427 |
placeholder=(
|
| 428 |
"coffee-shop interior — brick wall, orange sofa, neon sign\n"
|
| 429 |
"young man in a dark-grey hoodie with a Samoyed"
|
| 430 |
),
|
| 431 |
)
|
| 432 |
audio_ref = gr.Textbox(
|
| 433 |
+
label="Audio reference · describe",
|
| 434 |
lines=2,
|
| 435 |
+
info=(
|
| 436 |
+
f"Describe the sound or voice to match (one per line), up to "
|
| 437 |
+
f"{REF_LIMITS['audio']} — text only."
|
| 438 |
+
),
|
| 439 |
placeholder=(
|
| 440 |
"gentle waves and wind continuity (not a 1:1 copy)\n"
|
| 441 |
"distant seabird calls"
|