Spaces:
Running
on
Zero
Running
on
Zero
update interface
Browse files
app.py
CHANGED
@@ -166,16 +166,19 @@ with gr.Blocks() as demo:
|
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|
168 |
image = gr.Image(type='pil', label='Upload image')
|
169 |
-
image_url = gr.Textbox(label='Image url', placeholder='Enter text prompts (Optional)')
|
170 |
task_prompt = gr.Dropdown(
|
171 |
['<OD>', '<CAPTION_TO_PHRASE_GROUNDING>', '<DENSE_REGION_CAPTION>', '<REGION_PROPOSAL>', '<OCR_WITH_REGION>', '<REFERRING_EXPRESSION_SEGMENTATION>', '<REGION_TO_SEGMENTATION>', '<OPEN_VOCABULARY_DETECTION>', '<REGION_TO_CATEGORY>', '<REGION_TO_DESCRIPTION>'], value="<CAPTION_TO_PHRASE_GROUNDING>", label="Task Prompt", info=update_task_info("<CAPTION_TO_PHRASE_GROUNDING>")
|
172 |
)
|
173 |
-
dilate = gr.Slider(label="dilate mask", minimum=0, maximum=50, value=10, step=1, info="The dilate parameter controls the expansion of the mask's white areas by a specified number of pixels. Increasing this value will enlarge the white regions, which can help in smoothing out the mask's edges or covering more area in the segmentation.")
|
174 |
-
merge_masks = gr.Checkbox(label="Merge masks", value=False, info="The merge_masks parameter combines all the individual masks into a single mask. When enabled, the separate masks generated for different objects or regions will be merged into one unified mask, which can simplify further processing or visualization.")
|
175 |
-
return_rectangles = gr.Checkbox(label="Return Rectangles", value=False, info="The return_rectangles parameter, when enabled, generates masks as filled white rectangles corresponding to the bounding boxes of detected objects, rather than detailed contours or segments. This option is useful for simpler, box-based visualizations.")
|
176 |
-
invert_mask = gr.Checkbox(label="invert mask", value=False, info="The invert_mask option allows you to reverse the colors of the generated mask, changing black areas to white and white areas to black. This can be useful for visualizing or processing the mask in a different context.")
|
177 |
text_prompt = gr.Textbox(label='Text prompt', placeholder='Enter text prompts')
|
178 |
submit_button = gr.Button(value='Submit', variant='primary')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
with gr.Column():
|
180 |
image_gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery", columns=[3], rows=[1], object_fit="contain", height="auto")
|
181 |
# json_result = gr.Code(label="JSON Result", language="json")
|
|
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|
168 |
image = gr.Image(type='pil', label='Upload image')
|
169 |
+
image_url = gr.Textbox(label='Image url', placeholder='Enter text prompts (Optional)', info="The image_url parameter allows you to input a URL pointing to an image.")
|
170 |
task_prompt = gr.Dropdown(
|
171 |
['<OD>', '<CAPTION_TO_PHRASE_GROUNDING>', '<DENSE_REGION_CAPTION>', '<REGION_PROPOSAL>', '<OCR_WITH_REGION>', '<REFERRING_EXPRESSION_SEGMENTATION>', '<REGION_TO_SEGMENTATION>', '<OPEN_VOCABULARY_DETECTION>', '<REGION_TO_CATEGORY>', '<REGION_TO_DESCRIPTION>'], value="<CAPTION_TO_PHRASE_GROUNDING>", label="Task Prompt", info=update_task_info("<CAPTION_TO_PHRASE_GROUNDING>")
|
172 |
)
|
|
|
|
|
|
|
|
|
173 |
text_prompt = gr.Textbox(label='Text prompt', placeholder='Enter text prompts')
|
174 |
submit_button = gr.Button(value='Submit', variant='primary')
|
175 |
+
|
176 |
+
with gr.Accordion("Advance Settings", open=False):
|
177 |
+
dilate = gr.Slider(label="dilate mask", minimum=0, maximum=50, value=10, step=1, info="The dilate parameter controls the expansion of the mask's white areas by a specified number of pixels. Increasing this value will enlarge the white regions, which can help in smoothing out the mask's edges or covering more area in the segmentation.")
|
178 |
+
merge_masks = gr.Checkbox(label="Merge masks", value=False, info="The merge_masks parameter combines all the individual masks into a single mask. When enabled, the separate masks generated for different objects or regions will be merged into one unified mask, which can simplify further processing or visualization.")
|
179 |
+
return_rectangles = gr.Checkbox(label="Return Rectangles", value=False, info="The return_rectangles parameter, when enabled, generates masks as filled white rectangles corresponding to the bounding boxes of detected objects, rather than detailed contours or segments. This option is useful for simpler, box-based visualizations.")
|
180 |
+
invert_mask = gr.Checkbox(label="invert mask", value=False, info="The invert_mask option allows you to reverse the colors of the generated mask, changing black areas to white and white areas to black. This can be useful for visualizing or processing the mask in a different context.")
|
181 |
+
|
182 |
with gr.Column():
|
183 |
image_gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery", columns=[3], rows=[1], object_fit="contain", height="auto")
|
184 |
# json_result = gr.Code(label="JSON Result", language="json")
|