Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,6 +89,9 @@ def segment_image(input_image, text_input):
|
|
| 89 |
# Sort the segmented images by similarity in descending order
|
| 90 |
segmented_regions.sort(key=lambda x: x["similarity"], reverse=True)
|
| 91 |
|
|
|
|
|
|
|
|
|
|
| 92 |
# Return the segmented images in descending order of similarity
|
| 93 |
return segmented_regions
|
| 94 |
|
|
@@ -98,4 +101,4 @@ text_input = gr.Textbox(label="Text Input") # Use Textbox with a label
|
|
| 98 |
output_images = gr.outputs.JSON()
|
| 99 |
|
| 100 |
# Create a Gradio interface
|
| 101 |
-
gr.Interface(fn=segment_image, inputs=[input_image, text_input], outputs=output_images).launch(
|
|
|
|
| 89 |
# Sort the segmented images by similarity in descending order
|
| 90 |
segmented_regions.sort(key=lambda x: x["similarity"], reverse=True)
|
| 91 |
|
| 92 |
+
# Limit the output to the top 6 key-value pairs
|
| 93 |
+
segmented_regions = segmented_regions[:6]
|
| 94 |
+
|
| 95 |
# Return the segmented images in descending order of similarity
|
| 96 |
return segmented_regions
|
| 97 |
|
|
|
|
| 101 |
output_images = gr.outputs.JSON()
|
| 102 |
|
| 103 |
# Create a Gradio interface
|
| 104 |
+
gr.Interface(fn=segment_image, inputs=[input_image, text_input], outputs=output_images).launch()
|