yifehuang97 commited on
Commit
d14e981
·
1 Parent(s): 454211e

Add examples

Browse files
Files changed (2) hide show
  1. app.py +12 -14
  2. 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="Green Apple"
156
  )
157
 
158
  neg_caption = gr.Textbox(
159
  label="Negative Prompt (optional)",
160
  placeholder="e.g., Red Apple",
161
- value="Red Apple"
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
- # gr.Examples(
194
- # examples=[
195
- # ["examples/apples.jpg", "Green Apple", "Red Apple"],
196
- # ["examples/cars.jpg", "Red Car", "Blue Car"],
197
- # ["examples/people.jpg", "Person wearing hat", "Person without hat"],
198
- # ],
199
- # inputs=[input_image, pos_caption, neg_caption],
200
- # outputs=[output_image, count_output],
201
- # fn=count_objects,
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

  • SHA256: 61f259c8183e460c2d0af0d5578722be48ac190a25e679959ad92a9b6b8035cf
  • Pointer size: 132 Bytes
  • Size of remote file: 1.16 MB