Spaces:
Paused
Paused
File size: 815 Bytes
3f7365d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import subprocess, gradio as gr, os, sys
def run_game(prompt, res):
# launch Matrix-Game’s built-in CLI
cmd = [
sys.executable, "-m", "matrix_game.play",
"--prompt", prompt,
"--resolution", res
]
# stream logs to the browser so you see progress
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in process.stdout:
yield line.decode()
with gr.Blocks() as demo:
gr.Markdown("# Matrix-Game 2.0 interactive world model")
prompt = gr.Textbox(value="sunny beach with palm trees", label="Text prompt")
res = gr.Radio(["512", "720"], value="512", label="Resolution (pixels)")
out = gr.Textbox(label="Build log", lines=20)
gr.Button("Generate & Play").click(run_game, [prompt, res], out)
demo.launch()
|