Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -43,6 +43,9 @@ def build_dataset(base_path):
|
|
| 43 |
|
| 44 |
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")
|
| 45 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# Fonction load_and_preprocess_image (inchangée)
|
| 48 |
def load_and_preprocess_image(img_path):
|
|
|
|
| 43 |
|
| 44 |
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")
|
| 45 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 46 |
+
model = AutoModelForImageClassification.from_pretrained("microsoft/resnet-50")
|
| 47 |
+
model.to(device)
|
| 48 |
+
model.eval()
|
| 49 |
|
| 50 |
# Fonction load_and_preprocess_image (inchangée)
|
| 51 |
def load_and_preprocess_image(img_path):
|