RayanRen commited on
Commit
aae75ab
Β·
1 Parent(s): d57b721

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -31,12 +31,16 @@ def predict(img):
31
  title = "FoodVision Mini πŸ•πŸ₯©πŸ£"
32
  description = "An EfficientNetB2 feature extractor computer vision model to classify images of food as pizza, steak or sushi."
33
  article = "Created at [09. PyTorch Model Deployment](https://www.learnpytorch.io/09_pytorch_model_deployment/)."
34
- example_list = [[str(filepath)] for filepath in random.sample(test_data_paths, k=3)]
 
 
 
35
  # Create the Gradio demo
36
  demo = gr.Interface(fn=predict, # mapping function from input to output
37
  inputs=gr.Image(type="pil"), # what are the inputs?
38
  outputs=[gr.Label(num_top_classes=3, label="Predictions"), # what are the outputs?
39
  gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
 
40
  examples=example_list,
41
  title=title,
42
  description=description,
 
31
  title = "FoodVision Mini πŸ•πŸ₯©πŸ£"
32
  description = "An EfficientNetB2 feature extractor computer vision model to classify images of food as pizza, steak or sushi."
33
  article = "Created at [09. PyTorch Model Deployment](https://www.learnpytorch.io/09_pytorch_model_deployment/)."
34
+
35
+ # Create examples list from "examples/" directory
36
+ example_list = [["examples/" + example] for example in os.listdir("examples")]
37
+
38
  # Create the Gradio demo
39
  demo = gr.Interface(fn=predict, # mapping function from input to output
40
  inputs=gr.Image(type="pil"), # what are the inputs?
41
  outputs=[gr.Label(num_top_classes=3, label="Predictions"), # what are the outputs?
42
  gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
43
+ # Create examples list from "examples/" directory
44
  examples=example_list,
45
  title=title,
46
  description=description,