Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,12 +6,12 @@ import torchvision.models as models
|
|
| 6 |
|
| 7 |
# Load model
|
| 8 |
model = models.resnet18()
|
| 9 |
-
model.fc = torch.nn.Linear(model.fc.in_features,
|
| 10 |
model.load_state_dict(torch.load("animal_classifier.pth", map_location=torch.device('cpu')))
|
| 11 |
model.eval()
|
| 12 |
|
| 13 |
# Class labels (update as needed)
|
| 14 |
-
class_labels = ["
|
| 15 |
|
| 16 |
# Transform
|
| 17 |
transform = transforms.Compose([
|
|
|
|
| 6 |
|
| 7 |
# Load model
|
| 8 |
model = models.resnet18()
|
| 9 |
+
model.fc = torch.nn.Linear(model.fc.in_features, 13) # Change '3' to the number of your classes
|
| 10 |
model.load_state_dict(torch.load("animal_classifier.pth", map_location=torch.device('cpu')))
|
| 11 |
model.eval()
|
| 12 |
|
| 13 |
# Class labels (update as needed)
|
| 14 |
+
class_labels = ["antelope", "badger", "bat", "bear", "bee", "beetle","jellyfish","kangaroo","koala", "ladybug","leopard","lion","lizard"] # <-- Replace with your real class names
|
| 15 |
|
| 16 |
# Transform
|
| 17 |
transform = transforms.Compose([
|