Spaces:
Runtime error
Runtime error
This time it will work
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ learn = load_learner('model.pth')
|
|
6 |
def classify_image(img):
|
7 |
celebrity_name,_,probs = learn.predict(img)
|
8 |
results = dict(zip(list(learn.dls.vocab),probs))
|
9 |
-
best_results = sorted(
|
10 |
-
probabilities = {key:
|
11 |
return {probabilities}
|
12 |
|
13 |
image = gr.inputs.Image(shape=(224,224))
|
|
|
6 |
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))
|