Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,19 +100,19 @@ def sepia(input_img):
|
|
100 |
color_seg[seg.numpy() == label, :] = color
|
101 |
|
102 |
seg_text = segmentation_to_text(seg)
|
103 |
-
|
104 |
-
# Show image + mask
|
105 |
-
pred_img = np.array(input_img) * 0.5 + color_seg * 0.5
|
106 |
-
pred_img = pred_img.astype(np.uint8)
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
|
112 |
|
113 |
demo = gr.Interface(fn=sepia,
|
114 |
inputs=gr.Image(shape=(400, 600)),
|
115 |
-
outputs=
|
116 |
examples=["cityscapes-1.jpg", "cityscapes-2.jpg", "cityscapes-3.jpg"],
|
117 |
allow_flagging='never')
|
118 |
|
|
|
100 |
color_seg[seg.numpy() == label, :] = color
|
101 |
|
102 |
seg_text = segmentation_to_text(seg)
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
pil_img = Image.fromarray(pred_img)
|
105 |
+
|
106 |
+
draw = ImageDraw.Draw(pil_img)
|
107 |
+
font = ImageFont.load_default()
|
108 |
+
draw.text((10,10), seg_text, font=font, fill="black")
|
109 |
+
|
110 |
+
return np.array(pil_img)
|
111 |
|
112 |
|
113 |
demo = gr.Interface(fn=sepia,
|
114 |
inputs=gr.Image(shape=(400, 600)),
|
115 |
+
outputs='image',
|
116 |
examples=["cityscapes-1.jpg", "cityscapes-2.jpg", "cityscapes-3.jpg"],
|
117 |
allow_flagging='never')
|
118 |
|