Spaces:
Running on Zero
Running on Zero
Justin Wood Claude Sonnet 4.6 commited on
Commit ·
fa899d5
1
Parent(s): 803d6ed
Stringify landmark dict keys before pose response
Browse filesorjson (the JSON renderer Gradio uses) rejects non-string dict keys
with TypeError: Dict key must be str. detect_landmarks returns
{int: {...}} so the /jiggle/pose response failed to serialize even
though the GPU work succeeded. Convert keys to str in the response.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -242,10 +242,12 @@ def _register_jiggle_routes(app: FastAPI) -> None:
|
|
| 242 |
except Exception as e:
|
| 243 |
raise HTTPException(status_code=500, detail=str(e))
|
| 244 |
|
|
|
|
|
|
|
| 245 |
return {
|
| 246 |
"transforms": transforms,
|
| 247 |
-
"tpose_landmarks": tpose_lm,
|
| 248 |
-
"target_landmarks": target_lm,
|
| 249 |
}
|
| 250 |
|
| 251 |
# Promote our routes ahead of Gradio's catch-all (GET /{path:path} SPA route)
|
|
|
|
| 242 |
except Exception as e:
|
| 243 |
raise HTTPException(status_code=500, detail=str(e))
|
| 244 |
|
| 245 |
+
# orjson (Gradio's response renderer) rejects non-string dict keys —
|
| 246 |
+
# detect_landmarks returns {int: {...}} so we stringify before returning.
|
| 247 |
return {
|
| 248 |
"transforms": transforms,
|
| 249 |
+
"tpose_landmarks": {str(k): v for k, v in tpose_lm.items()},
|
| 250 |
+
"target_landmarks": {str(k): v for k, v in target_lm.items()},
|
| 251 |
}
|
| 252 |
|
| 253 |
# Promote our routes ahead of Gradio's catch-all (GET /{path:path} SPA route)
|