fcakyon commited on
Commit
7b4e726
·
verified ·
1 Parent(s): 28a8385

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +1 -8
utils.py CHANGED
@@ -41,11 +41,4 @@ def analyze(image_path: str | None, image_url: str | None, model_id: str, token:
41
  results = model(img)
42
 
43
  classifications = results[0].classifications if hasattr(results[0], "classifications") else results[0]["classifications"]
44
- return {str(k): float(v) for k, v in (classifications.items() if isinstance(classifications, dict) else [(c["label"], c["score"]) for c in classifications])}
45
-
46
-
47
- def run_example(evt: gr.SelectData, token: str | None = None):
48
- """Handle example selection."""
49
- idx = max(0, min(int(getattr(evt, "index", 0)), len(EXAMPLE_ITEMS) - 1))
50
- url, model = EXAMPLE_ITEMS[idx]
51
- return analyze(None, url, model, token), gr.update(value=model), gr.update(value=url)
 
41
  results = model(img)
42
 
43
  classifications = results[0].classifications if hasattr(results[0], "classifications") else results[0]["classifications"]
44
+ return {str(k): float(v) for k, v in (classifications.items() if isinstance(classifications, dict) else [(c["label"], c["score"]) for c in classifications])}