Spaces:
Sleeping
Sleeping
Commit
·
d6b73e9
1
Parent(s):
bc09c89
Update app.py
Browse files
app.py
CHANGED
@@ -83,16 +83,15 @@ def sepia(input_img):
|
|
83 |
logits = tf.transpose(logits, [0, 2, 3, 1])
|
84 |
logits = tf.image.resize(
|
85 |
logits, input_img.size[::-1]
|
86 |
-
)
|
87 |
seg = tf.math.argmax(logits, axis=-1)[0]
|
88 |
|
89 |
color_seg = np.zeros(
|
90 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
91 |
-
)
|
92 |
for label, color in enumerate(colormap):
|
93 |
color_seg[seg.numpy() == label, :] = color
|
94 |
|
95 |
-
# Show image + mask
|
96 |
pred_img = np.array(input_img) * 0.5 + color_seg * 0.5
|
97 |
pred_img = pred_img.astype(np.uint8)
|
98 |
|
|
|
83 |
logits = tf.transpose(logits, [0, 2, 3, 1])
|
84 |
logits = tf.image.resize(
|
85 |
logits, input_img.size[::-1]
|
86 |
+
)
|
87 |
seg = tf.math.argmax(logits, axis=-1)[0]
|
88 |
|
89 |
color_seg = np.zeros(
|
90 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
91 |
+
)
|
92 |
for label, color in enumerate(colormap):
|
93 |
color_seg[seg.numpy() == label, :] = color
|
94 |
|
|
|
95 |
pred_img = np.array(input_img) * 0.5 + color_seg * 0.5
|
96 |
pred_img = pred_img.astype(np.uint8)
|
97 |
|