Spaces:
Sleeping
Sleeping
Commit
·
d14e981
1
Parent(s):
454211e
Add examples
Browse files- app.py +12 -14
- examples/apple.png +3 -0
app.py
CHANGED
|
@@ -152,13 +152,13 @@ def create_demo():
|
|
| 152 |
pos_caption = gr.Textbox(
|
| 153 |
label="Positive Prompt",
|
| 154 |
placeholder="e.g., Green Apple",
|
| 155 |
-
value="
|
| 156 |
)
|
| 157 |
|
| 158 |
neg_caption = gr.Textbox(
|
| 159 |
label="Negative Prompt (optional)",
|
| 160 |
placeholder="e.g., Red Apple",
|
| 161 |
-
value="
|
| 162 |
)
|
| 163 |
|
| 164 |
box_threshold = gr.Slider(
|
|
@@ -166,7 +166,7 @@ def create_demo():
|
|
| 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(
|
|
@@ -190,17 +190,15 @@ def create_demo():
|
|
| 190 |
count_output = gr.Textbox(label="Count Result")
|
| 191 |
|
| 192 |
# Example images
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
# cache_examples=False,
|
| 203 |
-
# )
|
| 204 |
|
| 205 |
submit_btn.click(
|
| 206 |
fn=count_objects,
|
|
|
|
| 152 |
pos_caption = gr.Textbox(
|
| 153 |
label="Positive Prompt",
|
| 154 |
placeholder="e.g., Green Apple",
|
| 155 |
+
value="Pos Caption Here."
|
| 156 |
)
|
| 157 |
|
| 158 |
neg_caption = gr.Textbox(
|
| 159 |
label="Negative Prompt (optional)",
|
| 160 |
placeholder="e.g., Red Apple",
|
| 161 |
+
value="None."
|
| 162 |
)
|
| 163 |
|
| 164 |
box_threshold = gr.Slider(
|
|
|
|
| 166 |
maximum=1.0,
|
| 167 |
value=0.42,
|
| 168 |
step=0.01,
|
| 169 |
+
label="Detection Threshold (0.42 = use model default)"
|
| 170 |
)
|
| 171 |
|
| 172 |
point_radius = gr.Slider(
|
|
|
|
| 190 |
count_output = gr.Textbox(label="Count Result")
|
| 191 |
|
| 192 |
# Example images
|
| 193 |
+
gr.Examples(
|
| 194 |
+
examples=[
|
| 195 |
+
["examples/apples.png", "Green Apple.", "Red Apple."],
|
| 196 |
+
],
|
| 197 |
+
inputs=[input_image, pos_caption, neg_caption],
|
| 198 |
+
outputs=[output_image, count_output],
|
| 199 |
+
fn=count_objects,
|
| 200 |
+
cache_examples=False,
|
| 201 |
+
)
|
|
|
|
|
|
|
| 202 |
|
| 203 |
submit_btn.click(
|
| 204 |
fn=count_objects,
|
examples/apple.png
ADDED
|
Git LFS Details
|