Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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,
|