Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -169,7 +169,12 @@ def _rollout(image: Image.Image, actions: torch.Tensor, seed: int, steps: int) -
|
|
| 169 |
return (np.clip(video, 0, 1) * 255).round().astype(np.uint8)
|
| 170 |
|
| 171 |
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
def predict(
|
| 174 |
image: Image.Image,
|
| 175 |
actions_json: str,
|
|
@@ -222,7 +227,7 @@ CSS = """
|
|
| 222 |
.dark .gradio-container { color: var(--body-text-color); }
|
| 223 |
"""
|
| 224 |
|
| 225 |
-
with gr.Blocks(
|
| 226 |
with gr.Column(elem_id="col-container"):
|
| 227 |
gr.Markdown(
|
| 228 |
"# WorldReforge: Cosmos3 Nano robot world model\n"
|
|
@@ -265,4 +270,4 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="WorldReforge") as demo:
|
|
| 265 |
cache_mode="lazy",
|
| 266 |
)
|
| 267 |
|
| 268 |
-
demo.launch(mcp_server=True)
|
|
|
|
| 169 |
return (np.clip(video, 0, 1) * 255).round().astype(np.uint8)
|
| 170 |
|
| 171 |
|
| 172 |
+
def _gpu_duration(image, actions_json, sample_id="", seed=DEFAULT_SEED, steps=DEFAULT_STEPS, *args, **kwargs):
|
| 173 |
+
# measured ~11 s for 30 steps on ZeroGPU large (+~15% and a few seconds for video encoding)
|
| 174 |
+
return int(4 + 0.43 * int(steps or DEFAULT_STEPS)) + 1
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
@spaces.GPU(duration=_gpu_duration)
|
| 178 |
def predict(
|
| 179 |
image: Image.Image,
|
| 180 |
actions_json: str,
|
|
|
|
| 227 |
.dark .gradio-container { color: var(--body-text-color); }
|
| 228 |
"""
|
| 229 |
|
| 230 |
+
with gr.Blocks(title="WorldReforge") as demo:
|
| 231 |
with gr.Column(elem_id="col-container"):
|
| 232 |
gr.Markdown(
|
| 233 |
"# WorldReforge: Cosmos3 Nano robot world model\n"
|
|
|
|
| 270 |
cache_mode="lazy",
|
| 271 |
)
|
| 272 |
|
| 273 |
+
demo.launch(theme=gr.themes.Citrus(), css=CSS, mcp_server=True)
|