Spaces:
Sleeping
Sleeping
Commit
ยท
1d52402
1
Parent(s):
e5aa863
Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,17 @@ def sepia(input_img):
|
|
115 |
print(f"{label} probabilities:")
|
116 |
print(prob_map)
|
117 |
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
demo = gr.Interface(fn=sepia,
|
121 |
inputs=gr.Image(shape=(400, 600)),
|
|
|
115 |
print(f"{label} probabilities:")
|
116 |
print(prob_map)
|
117 |
|
118 |
+
class_probabilities = {
|
119 |
+
labels_list[i]: np.max(probabilities[:, :, i].numpy()) for i in range(len(labels_list))
|
120 |
+
}
|
121 |
+
|
122 |
+
# ๊ฐ์ฅ ๋์ ํ๋ฅ ์ ๊ฐ์ง ํด๋์ค๋ฅผ ์ถ๋ ฅ
|
123 |
+
max_prob_class = max(class_probabilities, key=class_probabilities.get)
|
124 |
+
max_prob_value = class_probabilities[max_prob_class]
|
125 |
+
|
126 |
+
print(f"Predicted class: {max_prob_class}, Probability: {max_prob_value:.4f}")
|
127 |
+
|
128 |
+
return fig, f"Predicted class: {max_prob_class}, Probability: {max_prob_value:.4f}"
|
129 |
|
130 |
demo = gr.Interface(fn=sepia,
|
131 |
inputs=gr.Image(shape=(400, 600)),
|