Spaces:
Sleeping
Sleeping
upd3
Browse files
app.py
CHANGED
@@ -8,10 +8,12 @@ import tensorflow as tf
|
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
-
"nickmuchi/segformer-b4-finetuned-segments-sidewalk"
|
|
|
12 |
)
|
13 |
model = TFSegformerForSemanticSegmentation.from_pretrained(
|
14 |
-
"nickmuchi/segformer-b4-finetuned-segments-sidewalk"
|
|
|
15 |
)
|
16 |
|
17 |
def ade_palette():
|
@@ -62,7 +64,7 @@ with open(r'labels.txt', 'r') as fp:
|
|
62 |
|
63 |
colormap = np.asarray(ade_palette())
|
64 |
|
65 |
-
|
66 |
def label_to_color_image(label):
|
67 |
if label.ndim != 2:
|
68 |
raise ValueError("Expect 2-D input label")
|
@@ -121,7 +123,7 @@ def sepia(input_img):
|
|
121 |
demo = gr.Interface(fn=sepia,
|
122 |
inputs=gr.Image(shape=(400, 600)),
|
123 |
outputs=['plot'],
|
124 |
-
examples=["sidewalk-1.jpg", "sidewalk-2.jpg", "sidewalk-
|
125 |
allow_flagging='never')
|
126 |
|
127 |
|
|
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
+
"nickmuchi/segformer-b4-finetuned-segments-sidewalk",
|
12 |
+
from_pt='True'
|
13 |
)
|
14 |
model = TFSegformerForSemanticSegmentation.from_pretrained(
|
15 |
+
"nickmuchi/segformer-b4-finetuned-segments-sidewalk",
|
16 |
+
from_pt='True'
|
17 |
)
|
18 |
|
19 |
def ade_palette():
|
|
|
64 |
|
65 |
colormap = np.asarray(ade_palette())
|
66 |
|
67 |
+
|
68 |
def label_to_color_image(label):
|
69 |
if label.ndim != 2:
|
70 |
raise ValueError("Expect 2-D input label")
|
|
|
123 |
demo = gr.Interface(fn=sepia,
|
124 |
inputs=gr.Image(shape=(400, 600)),
|
125 |
outputs=['plot'],
|
126 |
+
examples=["sidewalk-1.jpg", "sidewalk-2.jpg", "sidewalk-3.jpg"],
|
127 |
allow_flagging='never')
|
128 |
|
129 |
|