Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -135,7 +135,6 @@ Mask-Adapter effectively extends to SAM or SAM-2 without additional training, ac
|
|
135 |
</div>
|
136 |
"""
|
137 |
|
138 |
-
# Interface with mode selection using Tabs
|
139 |
with gr.Blocks() as demo:
|
140 |
gr.Markdown(title) # Title
|
141 |
gr.Markdown(description) # Description
|
@@ -160,20 +159,18 @@ with gr.Blocks() as demo:
|
|
160 |
gr.Examples(examples=examples, inputs=[input_image, class_names], outputs=output_image)
|
161 |
|
162 |
with gr.TabItem("Point Mode"):
|
163 |
-
with gr.Row():
|
164 |
with gr.Column():
|
165 |
def init_state():
|
166 |
return []
|
167 |
-
input_image = gr.Image(type='filepath', label="Upload Image", interactive=True)
|
168 |
-
points_input = gr.State(value=init_state())
|
169 |
|
170 |
-
with gr.Column():
|
171 |
-
output_image_point = gr.Image(type="pil", label='Segmentation Map')
|
172 |
|
173 |
-
# 直接使用 `SelectData` 事件触发 `inference_point`
|
174 |
input_image.select(inference_point, inputs=[input_image], outputs=output_image_point)
|
175 |
|
176 |
-
# 清除分割图的按钮
|
177 |
clear_button_point = gr.Button("Clear Segmentation Map")
|
178 |
clear_button_point.click(lambda: None, inputs=None, outputs=output_image_point)
|
179 |
|
|
|
135 |
</div>
|
136 |
"""
|
137 |
|
|
|
138 |
with gr.Blocks() as demo:
|
139 |
gr.Markdown(title) # Title
|
140 |
gr.Markdown(description) # Description
|
|
|
159 |
gr.Examples(examples=examples, inputs=[input_image, class_names], outputs=output_image)
|
160 |
|
161 |
with gr.TabItem("Point Mode"):
|
162 |
+
with gr.Row():
|
163 |
with gr.Column():
|
164 |
def init_state():
|
165 |
return []
|
166 |
+
input_image = gr.Image(type='filepath', label="Upload Image", interactive=True)
|
167 |
+
points_input = gr.State(value=init_state())
|
168 |
|
169 |
+
with gr.Column():
|
170 |
+
output_image_point = gr.Image(type="pil", label='Segmentation Map')
|
171 |
|
|
|
172 |
input_image.select(inference_point, inputs=[input_image], outputs=output_image_point)
|
173 |
|
|
|
174 |
clear_button_point = gr.Button("Clear Segmentation Map")
|
175 |
clear_button_point.click(lambda: None, inputs=None, outputs=output_image_point)
|
176 |
|