Spaces:
Sleeping
Sleeping
Commit
·
cc37cda
1
Parent(s):
18a078c
Update app.py
Browse files
app.py
CHANGED
@@ -103,17 +103,26 @@ def sepia(input_img):
|
|
103 |
class_prob = np.mean(logits.numpy()[0][mask])
|
104 |
class_probabilities[class_name] = class_prob
|
105 |
|
106 |
-
#
|
107 |
-
|
108 |
for class_name, prob in class_probabilities.items():
|
109 |
-
|
110 |
|
111 |
# 정확성이 가장 높은 물체 정보 출력
|
112 |
max_prob_class = max(class_probabilities, key=class_probabilities.get)
|
113 |
max_prob_value = class_probabilities[max_prob_class]
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
return fig, f"Predicted class with highest probability: {max_prob_class}, Probability: {max_prob_value:.4f}"
|
117 |
|
118 |
|
119 |
demo = gr.Interface(fn=sepia,
|
|
|
103 |
class_prob = np.mean(logits.numpy()[0][mask])
|
104 |
class_probabilities[class_name] = class_prob
|
105 |
|
106 |
+
# Gradio Interface에 출력할 문자열 생성
|
107 |
+
output_text = "Predicted class probabilities:\n"
|
108 |
for class_name, prob in class_probabilities.items():
|
109 |
+
output_text += f"{class_name}: {prob:.4f}\n"
|
110 |
|
111 |
# 정확성이 가장 높은 물체 정보 출력
|
112 |
max_prob_class = max(class_probabilities, key=class_probabilities.get)
|
113 |
max_prob_value = class_probabilities[max_prob_class]
|
114 |
+
output_text += f"\nPredicted class with highest probability: {max_prob_class}, Probability: {max_prob_value:.4f}"
|
115 |
+
|
116 |
+
return fig, output_text
|
117 |
+
|
118 |
+
demo = gr.Interface(fn=sepia,
|
119 |
+
inputs=gr.Image(shape=(400, 600)),
|
120 |
+
outputs=['plot', 'text'],
|
121 |
+
examples=["citiscapes-1.jpeg", "citiscapes-2.jpeg"],
|
122 |
+
allow_flagging='never')
|
123 |
+
|
124 |
+
demo.launch()
|
125 |
|
|
|
126 |
|
127 |
|
128 |
demo = gr.Interface(fn=sepia,
|