Spaces:
Runtime error
Runtime error
fix the import names and the name of the variables in list comprehension
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
### 1. Imports and class names setup ###
|
| 2 |
-
from model import
|
| 3 |
|
| 4 |
import torch
|
| 5 |
from typing import Tuple, Dict
|
|
@@ -9,11 +9,11 @@ import os
|
|
| 9 |
|
| 10 |
# Open Food101 class names file and read each line into a list
|
| 11 |
with open('class_names.txt', 'r') as f:
|
| 12 |
-
class_names = [food.strip() for food in
|
| 13 |
|
| 14 |
|
| 15 |
-
### 2. Model and transforms
|
| 16 |
-
model, model_transforms = create_vitB16_model(num_classes=
|
| 17 |
|
| 18 |
# Load save weights
|
| 19 |
model.load_state_dict(torch.load(f='09_pretrained_vit_feature_extractor_food101_20_percent.pth',
|
|
|
|
| 1 |
### 1. Imports and class names setup ###
|
| 2 |
+
from model import create_vitB16_model
|
| 3 |
|
| 4 |
import torch
|
| 5 |
from typing import Tuple, Dict
|
|
|
|
| 9 |
|
| 10 |
# Open Food101 class names file and read each line into a list
|
| 11 |
with open('class_names.txt', 'r') as f:
|
| 12 |
+
class_names = [food.strip() for food in f.readlines()]
|
| 13 |
|
| 14 |
|
| 15 |
+
### 2. Model and transforms preparation ###
|
| 16 |
+
model, model_transforms = create_vitB16_model(num_classes=101)
|
| 17 |
|
| 18 |
# Load save weights
|
| 19 |
model.load_state_dict(torch.load(f='09_pretrained_vit_feature_extractor_food101_20_percent.pth',
|