Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -161,8 +161,12 @@ def generate(
|
|
| 161 |
identity_rt = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
|
| 162 |
context_actions_t = torch.tensor([identity_rt], dtype=torch.float32)
|
| 163 |
|
| 164 |
-
# Build camera rotation action
|
| 165 |
cam_pose_actions = _build_rotation_action(deg, clockwise, NUM_FRAMES)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
# Generate video
|
| 168 |
print(f"[generate] Generating {NUM_FRAMES} frames @ {WIDTH}x{HEIGHT}, rotation={deg}° {'CW' if clockwise else 'CCW'}")
|
|
@@ -170,7 +174,7 @@ def generate(
|
|
| 170 |
pipe=pipe,
|
| 171 |
prompt=prompt,
|
| 172 |
use_negative_prompt=DEFAULT_NEGATIVE_PROMPT,
|
| 173 |
-
|
| 174 |
context_latents=context_latents,
|
| 175 |
num_context_frames=num_context_frames,
|
| 176 |
context_actions_t=context_actions_t,
|
|
@@ -199,7 +203,7 @@ CSS = """
|
|
| 199 |
.dark .gradio-container { color: var(--body-text-color); }
|
| 200 |
"""
|
| 201 |
|
| 202 |
-
with gr.Blocks(
|
| 203 |
gr.Markdown("# 🧠 Echo-Memory: Action-Conditioned World Model")
|
| 204 |
gr.Markdown(
|
| 205 |
"Generate a video from an initial frame, a text prompt, and a camera rotation action. "
|
|
@@ -280,4 +284,4 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 280 |
api_name="generate",
|
| 281 |
)
|
| 282 |
|
| 283 |
-
demo.launch(theme=gr.themes.Citrus(), mcp_server=True)
|
|
|
|
| 161 |
identity_rt = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
|
| 162 |
context_actions_t = torch.tensor([identity_rt], dtype=torch.float32)
|
| 163 |
|
| 164 |
+
# Build camera rotation action JSON and write to temp file
|
| 165 |
cam_pose_actions = _build_rotation_action(deg, clockwise, NUM_FRAMES)
|
| 166 |
+
action_tmp = tempfile.NamedTemporaryFile(suffix=".json", delete=False, mode="w")
|
| 167 |
+
json.dump(cam_pose_actions, action_tmp)
|
| 168 |
+
action_tmp.close()
|
| 169 |
+
action_path = action_tmp.name
|
| 170 |
|
| 171 |
# Generate video
|
| 172 |
print(f"[generate] Generating {NUM_FRAMES} frames @ {WIDTH}x{HEIGHT}, rotation={deg}° {'CW' if clockwise else 'CCW'}")
|
|
|
|
| 174 |
pipe=pipe,
|
| 175 |
prompt=prompt,
|
| 176 |
use_negative_prompt=DEFAULT_NEGATIVE_PROMPT,
|
| 177 |
+
action_path=action_path,
|
| 178 |
context_latents=context_latents,
|
| 179 |
num_context_frames=num_context_frames,
|
| 180 |
context_actions_t=context_actions_t,
|
|
|
|
| 203 |
.dark .gradio-container { color: var(--body-text-color); }
|
| 204 |
"""
|
| 205 |
|
| 206 |
+
with gr.Blocks() as demo:
|
| 207 |
gr.Markdown("# 🧠 Echo-Memory: Action-Conditioned World Model")
|
| 208 |
gr.Markdown(
|
| 209 |
"Generate a video from an initial frame, a text prompt, and a camera rotation action. "
|
|
|
|
| 284 |
api_name="generate",
|
| 285 |
)
|
| 286 |
|
| 287 |
+
demo.launch(theme=gr.themes.Citrus(), css=CSS, mcp_server=True)
|