Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,9 +98,9 @@ def predict(input_img):
|
|
| 98 |
predictions = model.predict(input_img_array)
|
| 99 |
predicted_class = np.argmax(predictions)
|
| 100 |
|
| 101 |
-
# Create a custom bar chart using gr.
|
| 102 |
prob_values = predictions[0].tolist()
|
| 103 |
-
bar_chart = gr.
|
| 104 |
|
| 105 |
return input_img, {
|
| 106 |
"Predicted Class": labels_list[predicted_class],
|
|
@@ -111,6 +111,6 @@ def predict(input_img):
|
|
| 111 |
gr.Interface(
|
| 112 |
predict,
|
| 113 |
inputs=gr.Image(label="Select an image", type="pil"),
|
| 114 |
-
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Predicted Class"), gr.
|
| 115 |
title="ResNet15 Image Classification"
|
| 116 |
).launch()
|
|
|
|
| 98 |
predictions = model.predict(input_img_array)
|
| 99 |
predicted_class = np.argmax(predictions)
|
| 100 |
|
| 101 |
+
# Create a custom bar chart using gr.Tabs
|
| 102 |
prob_values = predictions[0].tolist()
|
| 103 |
+
bar_chart = gr.Tabs(data=[[labels_list[i], prob_values[i]] for i in range(len(labels_list))], columns=["Label", "Probability"])
|
| 104 |
|
| 105 |
return input_img, {
|
| 106 |
"Predicted Class": labels_list[predicted_class],
|
|
|
|
| 111 |
gr.Interface(
|
| 112 |
predict,
|
| 113 |
inputs=gr.Image(label="Select an image", type="pil"),
|
| 114 |
+
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Predicted Class"), gr.Tabs(label="Probabilities")],
|
| 115 |
title="ResNet15 Image Classification"
|
| 116 |
).launch()
|