Spaces:
Sleeping
Sleeping
jioji0
commited on
Commit
•
ae3d07d
1
Parent(s):
2687670
tf
Browse files
app.py
CHANGED
@@ -5,12 +5,12 @@ import matplotlib.pyplot as plt
|
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
import tensorflow as tf
|
8 |
-
from transformers import SegformerFeatureExtractor,
|
9 |
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
"nvidia/segformer-b2-finetuned-cityscapes-1024-1024"
|
12 |
)
|
13 |
-
model =
|
14 |
"nvidia/segformer-b2-finetuned-cityscapes-1024-1024"
|
15 |
)
|
16 |
|
@@ -101,12 +101,6 @@ def sepia(input_img):
|
|
101 |
fig = draw_plot(pred_img, seg)
|
102 |
return fig
|
103 |
|
104 |
-
#def prepro_img(img):
|
105 |
-
#print("Preprocessing image...")
|
106 |
-
#img = img.resize((1024,1024))
|
107 |
-
#print("Image preprocessing completed.")
|
108 |
-
#return img
|
109 |
-
|
110 |
demo = gr.Interface(fn=sepia,
|
111 |
inputs=gr.Image(shape=(400, 600)),
|
112 |
#inputs=gr.Image(type='pil', prepeocessing_function=prepro_img),
|
|
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
import tensorflow as tf
|
8 |
+
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
"nvidia/segformer-b2-finetuned-cityscapes-1024-1024"
|
12 |
)
|
13 |
+
model = TFSegformerForSemanticSegmentation.from_pretrained(
|
14 |
"nvidia/segformer-b2-finetuned-cityscapes-1024-1024"
|
15 |
)
|
16 |
|
|
|
101 |
fig = draw_plot(pred_img, seg)
|
102 |
return fig
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
demo = gr.Interface(fn=sepia,
|
105 |
inputs=gr.Image(shape=(400, 600)),
|
106 |
#inputs=gr.Image(type='pil', prepeocessing_function=prepro_img),
|