Sjleeiv commited on
Commit
2cd4f51
·
1 Parent(s): 8fd4573

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 component
102
  prob_values = predictions[0].tolist()
103
- bar_chart = gr.Component(type="Bar", arg=prob_values, data={"labels": labels_list})
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.Component(label="Probabilities")],
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.Table
102
  prob_values = predictions[0].tolist()
103
+ bar_chart = gr.Table(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.Table(label="Probabilities")],
115
  title="ResNet15 Image Classification"
116
  ).launch()