Spaces:
Running on Zero
Running on Zero
log token
Browse files
app.py
CHANGED
|
@@ -285,7 +285,7 @@ def read_script(workdir: Path) -> str:
|
|
| 285 |
|
| 286 |
|
| 287 |
def run_agent(prompt: str, max_steps: int = 12, temperature: float = 1.0, top_p: float = 0.95,
|
| 288 |
-
max_new_tokens: int = 16384):
|
| 289 |
"""Turn a scene description into an animated 3D "draft video": Video-Coder-9B writes a Blender script, renders it,
|
| 290 |
inspects the frames, fixes problems and submits.
|
| 291 |
|
|
@@ -301,6 +301,15 @@ def run_agent(prompt: str, max_steps: int = 12, temperature: float = 1.0, top_p:
|
|
| 301 |
"""
|
| 302 |
if not prompt or not prompt.strip():
|
| 303 |
raise gr.Error("Please enter a scene description.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
workdir = (RUNS_DIR / uuid.uuid4().hex).resolve()
|
| 305 |
workdir.mkdir(parents=True)
|
| 306 |
messages = [
|
|
|
|
| 285 |
|
| 286 |
|
| 287 |
def run_agent(prompt: str, max_steps: int = 12, temperature: float = 1.0, top_p: float = 0.95,
|
| 288 |
+
max_new_tokens: int = 16384, request: gr.Request = None):
|
| 289 |
"""Turn a scene description into an animated 3D "draft video": Video-Coder-9B writes a Blender script, renders it,
|
| 290 |
inspects the frames, fixes problems and submits.
|
| 291 |
|
|
|
|
| 301 |
"""
|
| 302 |
if not prompt or not prompt.strip():
|
| 303 |
raise gr.Error("Please enter a scene description.")
|
| 304 |
+
try:
|
| 305 |
+
_tok = request.headers.get("x-ip-token") if request is not None else None
|
| 306 |
+
if _tok:
|
| 307 |
+
_p = json.loads(base64.urlsafe_b64decode(_tok.split(".")[1] + "=="))
|
| 308 |
+
print("x-ip-token payload:", {k: v for k, v in _p.items() if k in ("exp", "iat", "nbf")}, "now", time.time())
|
| 309 |
+
else:
|
| 310 |
+
print("no x-ip-token")
|
| 311 |
+
except Exception as e:
|
| 312 |
+
print("token decode failed", e)
|
| 313 |
workdir = (RUNS_DIR / uuid.uuid4().hex).resolve()
|
| 314 |
workdir.mkdir(parents=True)
|
| 315 |
messages = [
|