Spaces:
Runtime error
Runtime error
fix(app): add type hint to api_add_photo for Gradio 6.17
Browse filesGradio Server API endpoints require type hints on all parameters.
Without str | dict on image_path, server.launch() fails at startup.
Co-authored-by: Cursor <cursoragent@cursor.com>
app.py
CHANGED
|
@@ -821,7 +821,7 @@ def _build_custom_server():
|
|
| 821 |
return {"garments": catalog, "count": len(catalog)}
|
| 822 |
|
| 823 |
@server.api(name="add_photo")
|
| 824 |
-
def api_add_photo(image_path) -> dict:
|
| 825 |
if isinstance(image_path, dict):
|
| 826 |
image_path = image_path.get("path") or image_path.get("url", "")
|
| 827 |
results = extract_garments(str(image_path))
|
|
|
|
| 821 |
return {"garments": catalog, "count": len(catalog)}
|
| 822 |
|
| 823 |
@server.api(name="add_photo")
|
| 824 |
+
def api_add_photo(image_path: str | dict) -> dict:
|
| 825 |
if isinstance(image_path, dict):
|
| 826 |
image_path = image_path.get("path") or image_path.get("url", "")
|
| 827 |
results = extract_garments(str(image_path))
|