Update app.py
Browse files
app.py
CHANGED
@@ -212,7 +212,7 @@ def inference(img):
|
|
212 |
for i, item in enumerate(top_5):
|
213 |
class_index = item if includes_background_class else item + 1
|
214 |
line = f'({i+1}) {class_index:4} - {classes[class_index]}: {probabilities[0][top_5][i]}'
|
215 |
-
result[classes[class_index]] = probabilities[0][top_5][i]
|
216 |
return result
|
217 |
|
218 |
gr.Interface(inference,gr.inputs.Image(type="filepath"),"label").launch()
|
|
|
212 |
for i, item in enumerate(top_5):
|
213 |
class_index = item if includes_background_class else item + 1
|
214 |
line = f'({i+1}) {class_index:4} - {classes[class_index]}: {probabilities[0][top_5][i]}'
|
215 |
+
result[classes[class_index]] = probabilities[0][top_5][i].item()
|
216 |
return result
|
217 |
|
218 |
gr.Interface(inference,gr.inputs.Image(type="filepath"),"label").launch()
|