Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,11 +45,13 @@ def get_out_image(image, predicted_semantic_map):
|
|
45 |
extracted_tags = []
|
46 |
for id, (y, x) in class_centers.items():
|
47 |
class_name = str(class_names[id - 1])
|
48 |
-
extracted_tags.append(
|
49 |
draw.text((x, y), class_name, fill='black')
|
50 |
|
51 |
return image_mask, extracted_tags
|
52 |
|
|
|
|
|
53 |
def gradio_process(image):
|
54 |
inputs = processor(images=image, return_tensors="pt")
|
55 |
|
@@ -74,10 +76,11 @@ model.eval()
|
|
74 |
demo = gr.Interface(
|
75 |
gradio_process,
|
76 |
inputs=gr.inputs.Image(type="pil"),
|
77 |
-
outputs=[gr.outputs.Image(type="pil"), gr.outputs.
|
78 |
title="Semantic Segmentation",
|
79 |
examples=glob.glob('./examples/*.jpg'),
|
80 |
allow_flagging="never",
|
81 |
)
|
82 |
|
|
|
83 |
demo.launch()
|
|
|
45 |
extracted_tags = []
|
46 |
for id, (y, x) in class_centers.items():
|
47 |
class_name = str(class_names[id - 1])
|
48 |
+
extracted_tags.append(class_name) # Only appending the class_name
|
49 |
draw.text((x, y), class_name, fill='black')
|
50 |
|
51 |
return image_mask, extracted_tags
|
52 |
|
53 |
+
|
54 |
+
|
55 |
def gradio_process(image):
|
56 |
inputs = processor(images=image, return_tensors="pt")
|
57 |
|
|
|
76 |
demo = gr.Interface(
|
77 |
gradio_process,
|
78 |
inputs=gr.inputs.Image(type="pil"),
|
79 |
+
outputs=[gr.outputs.Image(type="pil"), gr.outputs.Text()],
|
80 |
title="Semantic Segmentation",
|
81 |
examples=glob.glob('./examples/*.jpg'),
|
82 |
allow_flagging="never",
|
83 |
)
|
84 |
|
85 |
+
|
86 |
demo.launch()
|