ChristopherMarais commited on
Commit
7da5ccf
·
verified ·
1 Parent(s): ac52bdc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -188,11 +188,18 @@ def predict_beetle(img):
188
 
189
 
190
  # gradio app
191
- css = """
192
- button {
193
- width: auto; /* Set your desired width */
194
- }
195
- """
 
 
 
 
 
 
 
196
 
197
  with gr.Blocks() as demo: # css=css in the brackets
198
  gr.Markdown("<h1><center>Bark Beetle Classification<h1><center>")
@@ -205,5 +212,9 @@ with gr.Blocks() as demo: # css=css in the brackets
205
 
206
  # Set the gallery layout and height directly in the constructor
207
  gallery = gr.Gallery(label="Show images", show_label=True, elem_id="gallery", columns=8, height="auto")
 
 
 
 
208
  btn.click(predict_beetle, inputs, gallery)
209
  demo.launch(debug=True, show_error=True)
 
188
 
189
 
190
  # gradio app
191
+ # css = """
192
+ # button {
193
+ # width: auto; /* Set your desired width */
194
+ # }
195
+ # """
196
+
197
+ # Sample images directory
198
+ sample_images_dir = "example_images"
199
+
200
+ # Collect sample image paths (these should be paths to any images you want to use as examples)
201
+ example_images = [[os.path.join(sample_images_dir, img)] for img in os.listdir(sample_images_dir) if img.endswith(('.png', '.jpg', '.jpeg'))]
202
+
203
 
204
  with gr.Blocks() as demo: # css=css in the brackets
205
  gr.Markdown("<h1><center>Bark Beetle Classification<h1><center>")
 
212
 
213
  # Set the gallery layout and height directly in the constructor
214
  gallery = gr.Gallery(label="Show images", show_label=True, elem_id="gallery", columns=8, height="auto")
215
+
216
+ # Add examples for easy access
217
+ demo.examples = example_images
218
+
219
  btn.click(predict_beetle, inputs, gallery)
220
  demo.launch(debug=True, show_error=True)