Spaces:
Sleeping
Sleeping
Commit
·
2922eb9
1
Parent(s):
56ba6f3
adjust the layout
Browse files
app.py
CHANGED
|
@@ -134,13 +134,15 @@ def count_objects(image, pos_caption, neg_caption, box_threshold, point_radius,
|
|
| 134 |
def create_demo():
|
| 135 |
with gr.Blocks(title="CountEx: Discriminative Visual Counting") as demo:
|
| 136 |
gr.Markdown("""
|
| 137 |
-
# CountEx:
|
| 138 |
|
| 139 |
Count specific objects in images using positive and negative text prompts.
|
| 140 |
|
| 141 |
-
**Positive Prompt**: Describe what you want to count (e.g., "Green Apple")
|
| 142 |
|
| 143 |
-
**Negative Prompt**: Describe what you want to exclude (e.g., "Red Apple")
|
|
|
|
|
|
|
| 144 |
""")
|
| 145 |
|
| 146 |
with gr.Row():
|
|
@@ -159,28 +161,27 @@ def create_demo():
|
|
| 159 |
value="Red Apple"
|
| 160 |
)
|
| 161 |
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
)
|
| 184 |
|
| 185 |
submit_btn = gr.Button("Count Objects", variant="primary")
|
| 186 |
|
|
|
|
| 134 |
def create_demo():
|
| 135 |
with gr.Blocks(title="CountEx: Discriminative Visual Counting") as demo:
|
| 136 |
gr.Markdown("""
|
| 137 |
+
# CountEx: Fine-Grained Counting via Exemplars and Exclusion
|
| 138 |
|
| 139 |
Count specific objects in images using positive and negative text prompts.
|
| 140 |
|
| 141 |
+
**Positive Prompt**: Describe what you want to count (e.g., "Green Apple.")
|
| 142 |
|
| 143 |
+
**Negative Prompt**: Describe what you want to exclude (e.g., "Red Apple.")
|
| 144 |
+
|
| 145 |
+
**Important Note: Both the Positive and Negative prompts must end with a period (.) for the model to correctly interpret the instruction.**
|
| 146 |
""")
|
| 147 |
|
| 148 |
with gr.Row():
|
|
|
|
| 161 |
value="Red Apple"
|
| 162 |
)
|
| 163 |
|
| 164 |
+
box_threshold = gr.Slider(
|
| 165 |
+
minimum=0.0,
|
| 166 |
+
maximum=1.0,
|
| 167 |
+
value=0.42,
|
| 168 |
+
step=0.01,
|
| 169 |
+
label="Detection Threshold (0 = use model default)"
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
point_radius = gr.Slider(
|
| 173 |
+
minimum=1,
|
| 174 |
+
maximum=20,
|
| 175 |
+
value=5,
|
| 176 |
+
step=1,
|
| 177 |
+
label="Point Radius"
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
point_color = gr.Dropdown(
|
| 181 |
+
choices=["blue", "red", "green", "yellow", "cyan", "magenta", "white"],
|
| 182 |
+
value="blue",
|
| 183 |
+
label="Point Color"
|
| 184 |
+
)
|
|
|
|
| 185 |
|
| 186 |
submit_btn = gr.Button("Count Objects", variant="primary")
|
| 187 |
|