Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- app.py +9 -12
- requirements.txt +3 -3
app.py
CHANGED
|
@@ -31,15 +31,14 @@ image_to_action_block = ModularPipelineBlocks.from_pretrained("dn6/matrix-game-i
|
|
| 31 |
|
| 32 |
blocks.sub_blocks.insert("image_to_action", image_to_action_block, 0)
|
| 33 |
|
| 34 |
-
pipe = MatrixGameWanModularPipeline(blocks, "diffusers
|
| 35 |
pipe.load_components(trust_remote_code=True, device_map="cuda", torch_dtype={"default": torch.bfloat16, "vae": torch.float32})
|
| 36 |
|
| 37 |
-
@spaces.GPU(
|
| 38 |
-
def predict(
|
| 39 |
-
output = pipe(image=
|
| 40 |
return export_to_video(output.values['videos'][0], "output.mp4")
|
| 41 |
|
| 42 |
-
|
| 43 |
examples = []
|
| 44 |
|
| 45 |
css = """
|
|
@@ -60,19 +59,19 @@ with gr.Blocks(css=css) as demo:
|
|
| 60 |
with gr.Column(elem_id="col-container"):
|
| 61 |
with gr.Row():
|
| 62 |
with gr.Column():
|
| 63 |
-
input_images = gr.
|
| 64 |
show_label=False,
|
| 65 |
type="pil",
|
| 66 |
interactive=True)
|
| 67 |
|
| 68 |
with gr.Column():
|
| 69 |
-
result = gr.
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
prompt = gr.Text(
|
| 73 |
label="Prompt",
|
| 74 |
show_label=False,
|
| 75 |
-
placeholder="describe the
|
| 76 |
container=False,
|
| 77 |
)
|
| 78 |
run_button = gr.Button("Run!", variant="primary")
|
|
@@ -81,11 +80,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 81 |
triggers=[run_button.click, prompt.submit],
|
| 82 |
fn=predict,
|
| 83 |
inputs=[
|
| 84 |
-
input_images,
|
| 85 |
prompt,
|
| 86 |
],
|
| 87 |
-
outputs=[result],
|
| 88 |
)
|
| 89 |
|
| 90 |
-
|
| 91 |
-
demo.launch()
|
|
|
|
| 31 |
|
| 32 |
blocks.sub_blocks.insert("image_to_action", image_to_action_block, 0)
|
| 33 |
|
| 34 |
+
pipe = MatrixGameWanModularPipeline(blocks, "diffusers/matrix-game-2-modular")
|
| 35 |
pipe.load_components(trust_remote_code=True, device_map="cuda", torch_dtype={"default": torch.bfloat16, "vae": torch.float32})
|
| 36 |
|
| 37 |
+
@spaces.GPU(120)
|
| 38 |
+
def predict(prompt):
|
| 39 |
+
output = pipe(image=None, prompt=prompt, num_frames=141)
|
| 40 |
return export_to_video(output.values['videos'][0], "output.mp4")
|
| 41 |
|
|
|
|
| 42 |
examples = []
|
| 43 |
|
| 44 |
css = """
|
|
|
|
| 59 |
with gr.Column(elem_id="col-container"):
|
| 60 |
with gr.Row():
|
| 61 |
with gr.Column():
|
| 62 |
+
input_images = gr.Image(label="Input Image",
|
| 63 |
show_label=False,
|
| 64 |
type="pil",
|
| 65 |
interactive=True)
|
| 66 |
|
| 67 |
with gr.Column():
|
| 68 |
+
result = gr.Video(label="Result")
|
| 69 |
|
| 70 |
with gr.Row():
|
| 71 |
prompt = gr.Text(
|
| 72 |
label="Prompt",
|
| 73 |
show_label=False,
|
| 74 |
+
placeholder="describe how you want to move in the image",
|
| 75 |
container=False,
|
| 76 |
)
|
| 77 |
run_button = gr.Button("Run!", variant="primary")
|
|
|
|
| 80 |
triggers=[run_button.click, prompt.submit],
|
| 81 |
fn=predict,
|
| 82 |
inputs=[
|
|
|
|
| 83 |
prompt,
|
| 84 |
],
|
| 85 |
+
outputs=[result],
|
| 86 |
)
|
| 87 |
|
| 88 |
+
demo.launch()
|
|
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
accelerate==1.10.1
|
| 2 |
einops==0.8.1
|
| 3 |
-
flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.
|
| 4 |
hf-transfer==0.1.9
|
| 5 |
hf-xet==1.1.8
|
| 6 |
huggingface-hub==0.34.4
|
|
@@ -8,8 +8,8 @@ imageio==2.37.0
|
|
| 8 |
imageio-ffmpeg==0.6.0
|
| 9 |
safetensors==0.6.2
|
| 10 |
sentencepiece==0.2.1
|
| 11 |
-
torch
|
| 12 |
torchao==0.12.0
|
| 13 |
-
torchvision
|
| 14 |
transformers==4.55.4
|
| 15 |
diffusers @ git+https://github.com/huggingface/diffusers.git
|
|
|
|
| 1 |
accelerate==1.10.1
|
| 2 |
einops==0.8.1
|
| 3 |
+
flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
|
| 4 |
hf-transfer==0.1.9
|
| 5 |
hf-xet==1.1.8
|
| 6 |
huggingface-hub==0.34.4
|
|
|
|
| 8 |
imageio-ffmpeg==0.6.0
|
| 9 |
safetensors==0.6.2
|
| 10 |
sentencepiece==0.2.1
|
| 11 |
+
torch==2.7.0
|
| 12 |
torchao==0.12.0
|
| 13 |
+
torchvision==0.22.0
|
| 14 |
transformers==4.55.4
|
| 15 |
diffusers @ git+https://github.com/huggingface/diffusers.git
|