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()