Bijan k
commited on
Commit
Β·
7b93fa6
1
Parent(s):
d853571
fixes
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ effnetb2, effnetb2_transforms = create_effnetb2_model(
|
|
| 20 |
# Load saved weights
|
| 21 |
effnetb2.load_state_dict(
|
| 22 |
torch.load(
|
| 23 |
-
f="
|
| 24 |
map_location=torch.device("cpu"), # load to CPU
|
| 25 |
)
|
| 26 |
)
|
|
@@ -55,9 +55,9 @@ def predict(img) -> Tuple[Dict, float]:
|
|
| 55 |
### 4. Gradio app ###
|
| 56 |
|
| 57 |
# Create title, description and article strings
|
| 58 |
-
title = "
|
| 59 |
description = "An EfficientNetB2 feature extractor computer vision model to classify images of food as pizza, steak or sushi."
|
| 60 |
-
article = "Created at [09. PyTorch Model Deployment](https://www.learnpytorch.io/09_pytorch_model_deployment/)."
|
| 61 |
|
| 62 |
# Create examples list from "examples/" directory
|
| 63 |
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
|
@@ -71,7 +71,8 @@ demo = gr.Interface(fn=predict, # mapping function from input to output
|
|
| 71 |
examples=example_list,
|
| 72 |
title=title,
|
| 73 |
description=description,
|
| 74 |
-
article=article
|
|
|
|
| 75 |
|
| 76 |
# Launch the demo!
|
| 77 |
demo.launch()
|
|
|
|
| 20 |
# Load saved weights
|
| 21 |
effnetb2.load_state_dict(
|
| 22 |
torch.load(
|
| 23 |
+
f="pretrained_effnetb2.pth",
|
| 24 |
map_location=torch.device("cpu"), # load to CPU
|
| 25 |
)
|
| 26 |
)
|
|
|
|
| 55 |
### 4. Gradio app ###
|
| 56 |
|
| 57 |
# Create title, description and article strings
|
| 58 |
+
title = "Food Classifier for ππ₯©π£"
|
| 59 |
description = "An EfficientNetB2 feature extractor computer vision model to classify images of food as pizza, steak or sushi."
|
| 60 |
+
# article = "Created at [09. PyTorch Model Deployment](https://www.learnpytorch.io/09_pytorch_model_deployment/)."
|
| 61 |
|
| 62 |
# Create examples list from "examples/" directory
|
| 63 |
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
|
|
|
| 71 |
examples=example_list,
|
| 72 |
title=title,
|
| 73 |
description=description,
|
| 74 |
+
# article=article
|
| 75 |
+
)
|
| 76 |
|
| 77 |
# Launch the demo!
|
| 78 |
demo.launch()
|