myers commited on
Commit
352e49f
β€’
1 Parent(s): 26699c3

don't hard code examples

Browse files
app.py CHANGED
@@ -1,5 +1,6 @@
1
  #!/usr/bin/env python3
2
 
 
3
  import gradio as gr
4
  from fastai.vision.all import *
5
  import skimage
@@ -16,10 +17,12 @@ def predict(img):
16
 
17
  title = "Hotdog or Not?"
18
  description = "Upload a picture of a hotdog or hamburger and be amazed!"
19
- examples = ["hotdog.jpg", "cat.jpg", "hamburger.jpg", "ham-sandwich.png"]
20
  interpretation = "default"
21
  enable_queue = True
22
 
 
 
 
23
  gr.Interface(
24
  fn=predict,
25
  inputs=gr.components.Image(shape=(512, 512)),
1
  #!/usr/bin/env python3
2
 
3
+ from pathlib import Path
4
  import gradio as gr
5
  from fastai.vision.all import *
6
  import skimage
17
 
18
  title = "Hotdog or Not?"
19
  description = "Upload a picture of a hotdog or hamburger and be amazed!"
 
20
  interpretation = "default"
21
  enable_queue = True
22
 
23
+ examples = [str(p) for p in Path("examples").glob("*")]
24
+ print(examples)
25
+
26
  gr.Interface(
27
  fn=predict,
28
  inputs=gr.components.Image(shape=(512, 512)),
cat.jpg β†’ examples/cat.jpg RENAMED
File without changes
ham-sandwich.png β†’ examples/ham-sandwich.png RENAMED
File without changes
hamburger.jpg β†’ examples/hamburger.jpg RENAMED
File without changes
hotdog.jpg β†’ examples/hotdog.jpg RENAMED
File without changes