Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch.nn as nn
|
|
| 4 |
from torchvision import models, transforms
|
| 5 |
from PIL import Image
|
| 6 |
import numpy as np
|
|
|
|
| 7 |
|
| 8 |
# -----------------------------
|
| 9 |
# Device
|
|
@@ -17,7 +18,7 @@ print(f"Using device: {device}")
|
|
| 17 |
class FoodIngredientClassifier(nn.Module):
|
| 18 |
def __init__(self, num_classes):
|
| 19 |
super().__init__()
|
| 20 |
-
self.backbone = models.resnet50(weights=
|
| 21 |
num_features = self.backbone.fc.in_features
|
| 22 |
self.backbone.fc = nn.Sequential(
|
| 23 |
nn.Dropout(0.5),
|
|
|
|
| 4 |
from torchvision import models, transforms
|
| 5 |
from PIL import Image
|
| 6 |
import numpy as np
|
| 7 |
+
from torchvision.models import ResNet50_Weights
|
| 8 |
|
| 9 |
# -----------------------------
|
| 10 |
# Device
|
|
|
|
| 18 |
class FoodIngredientClassifier(nn.Module):
|
| 19 |
def __init__(self, num_classes):
|
| 20 |
super().__init__()
|
| 21 |
+
self.backbone = models.resnet50(weights=models.ResNet50_Weights.IMAGENET1K_V1)
|
| 22 |
num_features = self.backbone.fc.in_features
|
| 23 |
self.backbone.fc = nn.Sequential(
|
| 24 |
nn.Dropout(0.5),
|