Ox1 Cursor commited on
Commit
2e31b50
·
1 Parent(s): b02e0ce

fix(app): add type hint to api_add_photo for Gradio 6.17

Browse files

Gradio 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>

Files changed (1) hide show
  1. app.py +1 -1
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))