Spaces:
Runtime error
Runtime error
Fix ouput dict containing tensor instead of float
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ def classify_image(img):
|
|
7 |
celebrity_name,_,probs = learn.predict(img)
|
8 |
results = dict(zip(list(learn.dls.vocab),probs))
|
9 |
best_results = sorted(results, key=results.get, reverse=True)[:5]
|
10 |
-
probabilities = {key: results[key] for key in best_results}
|
11 |
return {probabilities}
|
12 |
|
13 |
image = gr.inputs.Image(shape=(224,224))
|
|
|
7 |
celebrity_name,_,probs = learn.predict(img)
|
8 |
results = dict(zip(list(learn.dls.vocab),probs))
|
9 |
best_results = sorted(results, key=results.get, reverse=True)[:5]
|
10 |
+
probabilities = {key: float(results[key]) for key in best_results}
|
11 |
return {probabilities}
|
12 |
|
13 |
image = gr.inputs.Image(shape=(224,224))
|