nicodioub commited on
Commit
3be26bb
·
verified ·
1 Parent(s): 2a161ab

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +3 -0
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):