Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,20 @@ def sepia(input_img):
|
|
100 |
fig = draw_plot(pred_img, seg)
|
101 |
return fig
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
demo = gr.Interface(fn=sepia,
|
104 |
inputs=gr.Image(shape=(400, 600)),
|
105 |
outputs=['plot'],
|
|
|
100 |
fig = draw_plot(pred_img, seg)
|
101 |
return fig
|
102 |
|
103 |
+
# Obtain probabilities
|
104 |
+
probabilities = tf.nn.softmax(logits, axis=-1)
|
105 |
+
|
106 |
+
# Visualize probabilities as bar plot
|
107 |
+
plt.figure(figsize=(12,6))
|
108 |
+
class_names = labels_list
|
109 |
+
y_pos = np.arange(len(class_names))
|
110 |
+
plt.bart(y_pos, probabilities.numpy().mean(axis=(0, 1)), align='center')
|
111 |
+
plt.ytickes(y_pos, class_names)
|
112 |
+
plt.xlabel('Probability')
|
113 |
+
plt.title('Class Probabilities')
|
114 |
+
|
115 |
+
return plt.gcf()
|
116 |
+
|
117 |
demo = gr.Interface(fn=sepia,
|
118 |
inputs=gr.Image(shape=(400, 600)),
|
119 |
outputs=['plot'],
|