Spaces:
Runtime error
Runtime error
finish
Browse files
app.py
CHANGED
|
@@ -67,7 +67,6 @@ def draw_plot(pred_img, seg):
|
|
| 67 |
plt.imshow(pred_img)
|
| 68 |
plt.axis('off')
|
| 69 |
|
| 70 |
-
# ๋ผ๋ฒจ ์ด๋ฆ์ ์ถ๊ฐํ๊ธฐ ์ํ ์ฝ๋
|
| 71 |
LABEL_NAMES = np.asarray(labels_list)
|
| 72 |
FULL_LABEL_MAP = np.arange(len(LABEL_NAMES)).reshape(len(LABEL_NAMES), 1)
|
| 73 |
FULL_COLOR_MAP = label_to_color_image(FULL_LABEL_MAP)
|
|
@@ -80,16 +79,6 @@ def draw_plot(pred_img, seg):
|
|
| 80 |
plt.xticks([], [])
|
| 81 |
ax.tick_params(width=0.0, labelsize=25)
|
| 82 |
|
| 83 |
-
# ๋ผ๋ฒจ ์ด๋ฆ ํ
์คํธ ์ถ๊ฐ
|
| 84 |
-
for label, color in enumerate(colormap):
|
| 85 |
-
mask = seg.numpy() == label
|
| 86 |
-
if np.any(mask):
|
| 87 |
-
y, x = np.where(mask)
|
| 88 |
-
y = np.mean(y).astype(int)
|
| 89 |
-
x = np.mean(x).astype(int)
|
| 90 |
-
label_name = LABEL_NAMES[label]
|
| 91 |
-
plt.text(x, y, label_name, fontsize=20, color=tuple(color))
|
| 92 |
-
|
| 93 |
return fig
|
| 94 |
|
| 95 |
|
|
@@ -120,7 +109,7 @@ def sepia(input_img):
|
|
| 120 |
|
| 121 |
demo = gr.Interface(fn=sepia,
|
| 122 |
inputs=gr.Image(shape=(1024, 1024)),
|
| 123 |
-
outputs=['plot'],
|
| 124 |
examples=["city-1.jpg", "city-2.jpg", "city-3.jpg", "city-4.jpg", "city-5.jpg"],
|
| 125 |
allow_flagging='never')
|
| 126 |
|
|
|
|
| 67 |
plt.imshow(pred_img)
|
| 68 |
plt.axis('off')
|
| 69 |
|
|
|
|
| 70 |
LABEL_NAMES = np.asarray(labels_list)
|
| 71 |
FULL_LABEL_MAP = np.arange(len(LABEL_NAMES)).reshape(len(LABEL_NAMES), 1)
|
| 72 |
FULL_COLOR_MAP = label_to_color_image(FULL_LABEL_MAP)
|
|
|
|
| 79 |
plt.xticks([], [])
|
| 80 |
ax.tick_params(width=0.0, labelsize=25)
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
return fig
|
| 83 |
|
| 84 |
|
|
|
|
| 109 |
|
| 110 |
demo = gr.Interface(fn=sepia,
|
| 111 |
inputs=gr.Image(shape=(1024, 1024)),
|
| 112 |
+
outputs=['plot', 'text'],
|
| 113 |
examples=["city-1.jpg", "city-2.jpg", "city-3.jpg", "city-4.jpg", "city-5.jpg"],
|
| 114 |
allow_flagging='never')
|
| 115 |
|