app.py
CHANGED
@@ -14,16 +14,15 @@ feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-
|
|
14 |
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-640-1280")
|
15 |
|
16 |
urls = ["http://farm3.staticflickr.com/2523/3705549787_79049b1b6d_z.jpg",
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
images = []
|
22 |
for i in urls:
|
23 |
images.append(Image.open(requests.get(i, stream=True).raw))
|
24 |
|
25 |
|
26 |
-
|
27 |
# inputs = feature_extractor(images=image, return_tensors="pt")
|
28 |
# outputs = model(**inputs)
|
29 |
# logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
|
@@ -121,6 +120,6 @@ iface = gr.Interface(
|
|
121 |
fn=greet,
|
122 |
inputs=gr.Image(shape=(640, 1280)),
|
123 |
outputs=["plot"],
|
124 |
-
examples=
|
125 |
allow_flagging="never")
|
126 |
iface.launch(share=True)
|
|
|
14 |
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-640-1280")
|
15 |
|
16 |
urls = ["http://farm3.staticflickr.com/2523/3705549787_79049b1b6d_z.jpg",
|
17 |
+
"http://farm8.staticflickr.com/7012/6476201279_52db36af64_z.jpg",
|
18 |
+
"http://farm8.staticflickr.com/7180/6967423255_a3d65d5f6b_z.jpg",
|
19 |
+
"http://farm4.staticflickr.com/3563/3470840644_3378804bea_z.jpg",
|
20 |
+
"http://farm9.staticflickr.com/8388/8516454091_0ebdc1130a_z.jpg"]
|
21 |
images = []
|
22 |
for i in urls:
|
23 |
images.append(Image.open(requests.get(i, stream=True).raw))
|
24 |
|
25 |
|
|
|
26 |
# inputs = feature_extractor(images=image, return_tensors="pt")
|
27 |
# outputs = model(**inputs)
|
28 |
# logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
|
|
|
120 |
fn=greet,
|
121 |
inputs=gr.Image(shape=(640, 1280)),
|
122 |
outputs=["plot"],
|
123 |
+
examples=images,
|
124 |
allow_flagging="never")
|
125 |
iface.launch(share=True)
|