# `import spaces` first: it patches `torch.cuda` so the DiT load can happen at startup rather than on # GPU time. It must land before anything that could initialize CUDA. import spaces # noqa: F401 import gradio as gr # Importing orbit loads the MiniMax-H3 denoising partition and attaches the orbit LoRA (startup load). from orbit import OUTPUT_DIR, orbit # The canvas is the app: workflow.json wires the photo + knob references into the bound `orbit` # function, which runs locally on this Space's ZeroGPU hardware via @spaces.GPU — no gradio_client # call to the upstream Space. Editing the graph on the canvas autosaves back to workflow.json. demo = gr.Workflow(graph="workflow.json", bind={"orbit": orbit}) if __name__ == "__main__": # orbit() writes MP4s to OUTPUT_DIR (a subdir of the temp dir), which is outside gradio's # default file-serving allowlist — without this the video subject can't fetch the result. demo.launch(allowed_paths=[OUTPUT_DIR])