Spaces:
Running
Running
Commit
·
d3eb3e6
1
Parent(s):
f382990
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,11 @@ for model_id in get_model_ids():
|
|
| 14 |
models[model_id] = pipeline("image-classification", model=model_id)
|
| 15 |
|
| 16 |
def predict(img, model_id):
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
gr.Interface(
|
| 20 |
fn=predict,
|
|
|
|
| 14 |
models[model_id] = pipeline("image-classification", model=model_id)
|
| 15 |
|
| 16 |
def predict(img, model_id):
|
| 17 |
+
preds = models[model_id](img)
|
| 18 |
+
res = {}
|
| 19 |
+
for pred in preds:
|
| 20 |
+
res[pred["label"]] = pred["score"]
|
| 21 |
+
return res
|
| 22 |
|
| 23 |
gr.Interface(
|
| 24 |
fn=predict,
|