mrdbourke commited on
Commit
1090938
·
verified ·
1 Parent(s): 32cf9f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -145,6 +145,12 @@ def detect_and_draw(
145
  )
146
  return img_out
147
 
 
 
 
 
 
 
148
  # Create Gradio demo
149
  demo = gr.Interface(
150
  fn = detect_and_draw,
@@ -158,11 +164,8 @@ demo = gr.Interface(
158
  outputs = gr.Image(type="pil", label="Detections"),
159
  title = "LLMDet Demo: Open-Vocabulary Grounded Object Detection",
160
  description = f"""Upload an image, enter text queries, and adjust thresholds to see detections.
161
-
162
  Adapted from LLMDet GitHub repo [Hugging Face demo](https://github.com/iSEE-Laboratory/LLMDet/tree/main/hf_model).
163
-
164
  This space uses: {model_id}
165
-
166
  See original:
167
  * [LLMDet GitHub](https://github.com/iSEE-Laboratory/LLMDet/tree/main?tab=readme-ov-file)
168
  * [LLMDet Paper](https://arxiv.org/abs/2501.18954) - LLMDet: Learning Strong Open-Vocabulary Object Detectors under the Supervision of Large Language Models
@@ -170,7 +173,9 @@ demo = gr.Interface(
170
  * [Tiny](https://huggingface.co/fushh7/llmdet_swin_tiny_hf) (173M params)
171
  * [Base](https://huggingface.co/fushh7/llmdet_swin_base_hf) (233M params)
172
  * [Large](https://huggingface.co/fushh7/llmdet_swin_large_hf) (344M params)
173
- """
 
 
174
  )
175
 
176
  demo.launch()
 
145
  )
146
  return img_out
147
 
148
+ # Create example list
149
+ examples = [
150
+ ["examples/IMG_8920.jpeg", "bin. water bottle. hand. shoe.", 0.4, 0.3],
151
+ ["examples/IMG_9435.jpeg", "lettuce. orange slices (group). eggs (group). cheese (group). red cabbage. pear slices (group).", 0.4, 0.3],
152
+ ]
153
+
154
  # Create Gradio demo
155
  demo = gr.Interface(
156
  fn = detect_and_draw,
 
164
  outputs = gr.Image(type="pil", label="Detections"),
165
  title = "LLMDet Demo: Open-Vocabulary Grounded Object Detection",
166
  description = f"""Upload an image, enter text queries, and adjust thresholds to see detections.
 
167
  Adapted from LLMDet GitHub repo [Hugging Face demo](https://github.com/iSEE-Laboratory/LLMDet/tree/main/hf_model).
 
168
  This space uses: {model_id}
 
169
  See original:
170
  * [LLMDet GitHub](https://github.com/iSEE-Laboratory/LLMDet/tree/main?tab=readme-ov-file)
171
  * [LLMDet Paper](https://arxiv.org/abs/2501.18954) - LLMDet: Learning Strong Open-Vocabulary Object Detectors under the Supervision of Large Language Models
 
173
  * [Tiny](https://huggingface.co/fushh7/llmdet_swin_tiny_hf) (173M params)
174
  * [Base](https://huggingface.co/fushh7/llmdet_swin_base_hf) (233M params)
175
  * [Large](https://huggingface.co/fushh7/llmdet_swin_large_hf) (344M params)
176
+ """,
177
+ examples = examples,
178
+ cache_examples = True,
179
  )
180
 
181
  demo.launch()