Spaces:
Sleeping
Sleeping
Commit
ยท
ac55567
1
Parent(s):
f6cf171
Update app.py
Browse files
app.py
CHANGED
@@ -87,6 +87,8 @@ def sepia(input_img):
|
|
87 |
)
|
88 |
seg = tf.math.argmax(logits, axis=-1)[0]
|
89 |
|
|
|
|
|
90 |
color_seg = np.zeros(
|
91 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
92 |
)
|
@@ -97,14 +99,19 @@ def sepia(input_img):
|
|
97 |
pred_img = pred_img.astype(np.uint8)
|
98 |
|
99 |
fig = draw_plot(pred_img, seg)
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
return fig
|
102 |
|
103 |
demo = gr.Interface(fn=sepia,
|
104 |
inputs=gr.Image(shape=(400, 600)),
|
105 |
-
outputs=[
|
106 |
examples=["citiscapes-1.jpeg", "citiscapes-2.jpeg"],
|
107 |
allow_flagging='never')
|
108 |
|
109 |
-
|
110 |
demo.launch()
|
|
|
87 |
)
|
88 |
seg = tf.math.argmax(logits, axis=-1)[0]
|
89 |
|
90 |
+
probabilities = tf.nn.softmax(logits, axis=-1)[0] # ํ๋ฅ ๊ฐ ์ถ์ถ
|
91 |
+
|
92 |
color_seg = np.zeros(
|
93 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
94 |
)
|
|
|
99 |
pred_img = pred_img.astype(np.uint8)
|
100 |
|
101 |
fig = draw_plot(pred_img, seg)
|
102 |
+
|
103 |
+
# ๊ฐ ํด๋์ค์ ํ๋ฅ ์ ์ถ๋ ฅ
|
104 |
+
class_probabilities = {
|
105 |
+
labels_list[i]: probabilities[:, :, i].numpy() for i in range(len(labels_list))
|
106 |
+
}
|
107 |
+
print(class_probabilities)
|
108 |
+
|
109 |
return fig
|
110 |
|
111 |
demo = gr.Interface(fn=sepia,
|
112 |
inputs=gr.Image(shape=(400, 600)),
|
113 |
+
outputs=["plot", "text"],
|
114 |
examples=["citiscapes-1.jpeg", "citiscapes-2.jpeg"],
|
115 |
allow_flagging='never')
|
116 |
|
|
|
117 |
demo.launch()
|