Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -139,30 +139,13 @@ def inference_scribble(image):
|
|
139 |
return [Image.fromarray((mask_colors * 0.6 + test_image * 0.4).astype('uint8'), 'RGB'),
|
140 |
Image.fromarray((mask_colors ).astype('uint8'), 'RGB')]
|
141 |
|
142 |
-
'''
|
143 |
-
demo = gr.Interface(fn=inference_scribble,
|
144 |
-
inputs=gr.Image(label="[Stroke] Draw on Image", tool='sketch',type='pil'),
|
145 |
-
outputs=[
|
146 |
-
gr.Image(type="pil", label="Mask with Image"),
|
147 |
-
gr.Image(type="pil", label="Mask")
|
148 |
-
],
|
149 |
-
title="SAM based Segment Annotator.",
|
150 |
-
description='Sketch the portion where you want to create Mask.',
|
151 |
-
examples=[
|
152 |
-
"./cardamage_example/0006.JPEG",
|
153 |
-
"./cardamage_example/0008.JPEG",
|
154 |
-
"./cardamage_example/0206.JPEG"
|
155 |
-
]
|
156 |
-
)
|
157 |
-
demo.launch(enable_queue=False)
|
158 |
-
'''
|
159 |
|
160 |
with gr.Blocks() as demo:
|
161 |
-
gr.Markdown("#
|
162 |
gr.Markdown("To start, input an image, then use the brush to create dots on the object which you want to segment, don't worry if your dots aren't perfect as the code will find the middle of each drawn item. Then press the segment button to create masks for the object that the dots are on.")
|
163 |
-
gr.Markdown("
|
164 |
-
gr.Markdown("""This app uses the [
|
165 |
-
""")
|
166 |
with gr.Row():
|
167 |
image_input = gr.Image(label="[Stroke] Draw on Image", tool='sketch',type='pil')
|
168 |
image_output1 = gr.Image(type="pil", label="Mask with Image")
|
|
|
139 |
return [Image.fromarray((mask_colors * 0.6 + test_image * 0.4).astype('uint8'), 'RGB'),
|
140 |
Image.fromarray((mask_colors ).astype('uint8'), 'RGB')]
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
with gr.Blocks() as demo:
|
144 |
+
gr.Markdown("# Segmentation-Annotator-using-MobileSAM")
|
145 |
gr.Markdown("To start, input an image, then use the brush to create dots on the object which you want to segment, don't worry if your dots aren't perfect as the code will find the middle of each drawn item. Then press the segment button to create masks for the object that the dots are on.")
|
146 |
+
gr.Markdown("## Demo to run Mobile Segment Anything base model")
|
147 |
+
gr.Markdown("""This app uses the [MobileSAM](https://github.com/ChaoningZhang/MobileSAM.git) model to get a mask from a points in an image.""")
|
148 |
+
gr.Markdown("""Full code can be found here [SourceCode](https://github.com/ChaoningZhang/MobileSAM.git)""")
|
149 |
with gr.Row():
|
150 |
image_input = gr.Image(label="[Stroke] Draw on Image", tool='sketch',type='pil')
|
151 |
image_output1 = gr.Image(type="pil", label="Mask with Image")
|