Spaces:
Runtime error
Runtime error
upload v1667704347 model
Browse files- .gitattributes +2 -1
- app.py +5 -7
- palette.txt +3 -35
- test-image1.png +3 -0
- test-image.jpg → test-image2.png +2 -2
.gitattributes
CHANGED
@@ -31,4 +31,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
31 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
32 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
-
test-
|
|
|
|
31 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
32 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
+
test-image1.png filter=lfs diff=lfs merge=lfs -text
|
35 |
+
test-image2.png filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -4,18 +4,16 @@ import tensorflow as tf
|
|
4 |
from huggingface_hub import from_pretrained_keras
|
5 |
from PIL import Image
|
6 |
|
7 |
-
MODEL_CKPT = "chansung/segmentation-training-pipeline@
|
8 |
MODEL = from_pretrained_keras(MODEL_CKPT)
|
9 |
|
10 |
RESOLTUION = 128
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
ADE_PALETTE = []
|
15 |
with open(r"./palette.txt", "r") as fp:
|
16 |
for line in fp:
|
17 |
tmp_list = list(map(int, line[:-1].strip("][").split(", ")))
|
18 |
-
|
19 |
|
20 |
|
21 |
def preprocess_input(image: Image) -> tf.Tensor:
|
@@ -36,7 +34,7 @@ def get_seg_overlay(image, seg):
|
|
36 |
color_seg = np.zeros(
|
37 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
38 |
) # height, width, 3
|
39 |
-
palette = np.array(
|
40 |
|
41 |
for label, color in enumerate(palette):
|
42 |
color_seg[seg == label, :] = color
|
@@ -88,7 +86,7 @@ demo = gr.Interface(
|
|
88 |
allow_flagging="never",
|
89 |
title=title,
|
90 |
description=description,
|
91 |
-
examples=[["test-
|
92 |
)
|
93 |
|
94 |
demo.launch()
|
|
|
4 |
from huggingface_hub import from_pretrained_keras
|
5 |
from PIL import Image
|
6 |
|
7 |
+
MODEL_CKPT = "chansung/segmentation-training-pipeline@v1667704347"
|
8 |
MODEL = from_pretrained_keras(MODEL_CKPT)
|
9 |
|
10 |
RESOLTUION = 128
|
11 |
|
12 |
+
PETS_PALETTE = []
|
|
|
|
|
13 |
with open(r"./palette.txt", "r") as fp:
|
14 |
for line in fp:
|
15 |
tmp_list = list(map(int, line[:-1].strip("][").split(", ")))
|
16 |
+
PETS_PALETTE.append(tmp_list)
|
17 |
|
18 |
|
19 |
def preprocess_input(image: Image) -> tf.Tensor:
|
|
|
34 |
color_seg = np.zeros(
|
35 |
(seg.shape[0], seg.shape[1], 3), dtype=np.uint8
|
36 |
) # height, width, 3
|
37 |
+
palette = np.array(PETS_PALETTE)
|
38 |
|
39 |
for label, color in enumerate(palette):
|
40 |
color_seg[seg == label, :] = color
|
|
|
86 |
allow_flagging="never",
|
87 |
title=title,
|
88 |
description=description,
|
89 |
+
examples=[["test-image1.png"], ["test-image2.png"]],
|
90 |
)
|
91 |
|
92 |
demo.launch()
|
palette.txt
CHANGED
@@ -1,35 +1,3 @@
|
|
1 |
-
[0,
|
2 |
-
[
|
3 |
-
[255,
|
4 |
-
[125, 46, 141]
|
5 |
-
[118, 171, 47]
|
6 |
-
[161, 19, 46]
|
7 |
-
[255, 0, 0]
|
8 |
-
[0, 128, 128]
|
9 |
-
[190, 190, 0]
|
10 |
-
[0, 255, 0]
|
11 |
-
[0, 0, 255]
|
12 |
-
[170, 0, 255]
|
13 |
-
[84, 84, 0]
|
14 |
-
[84, 170, 0]
|
15 |
-
[84, 255, 0]
|
16 |
-
[170, 84, 0]
|
17 |
-
[170, 170, 0]
|
18 |
-
[170, 255, 0]
|
19 |
-
[255, 84, 0]
|
20 |
-
[255, 170, 0]
|
21 |
-
[255, 255, 0]
|
22 |
-
[33, 138, 200]
|
23 |
-
[0, 170, 127]
|
24 |
-
[0, 255, 127]
|
25 |
-
[84, 0, 127]
|
26 |
-
[84, 84, 127]
|
27 |
-
[84, 170, 127]
|
28 |
-
[84, 255, 127]
|
29 |
-
[170, 0, 127]
|
30 |
-
[170, 84, 127]
|
31 |
-
[170, 170, 127]
|
32 |
-
[170, 255, 127]
|
33 |
-
[255, 0, 127]
|
34 |
-
[255, 84, 127]
|
35 |
-
[255, 170, 127]
|
|
|
1 |
+
[0, 10, 146]
|
2 |
+
[38, 0, 44]
|
3 |
+
[255, 232, 0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test-image1.png
ADDED
![]() |
Git LFS Details
|
test-image.jpg → test-image2.png
RENAMED
File without changes
|