rararara9999 commited on
Commit
8a362fa
·
verified ·
1 Parent(s): 06fd26d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import subprocess
2
 
3
  # Install necessary packages
4
  subprocess.run(["pip", "install", "-U", "git+https://github.com/huggingface/transformers.git"])
@@ -28,7 +28,7 @@ for i, label in enumerate(labels):
28
 
29
  # Load the pre-trained model and processor
30
  model_checkpoint = "microsoft/resnet-50"
31
- model = AutoModelForImageClassification.from_pretrained(model_checkpoint, num_labels=len(labels))
32
  image_processor = AutoImageProcessor.from_pretrained(model_checkpoint)
33
 
34
  # Define the image transformations
@@ -82,3 +82,4 @@ trainer = Trainer(
82
  # Evaluate the pre-trained model
83
  metrics = trainer.evaluate()
84
  print(metrics)
 
 
1
+ import subprocess
2
 
3
  # Install necessary packages
4
  subprocess.run(["pip", "install", "-U", "git+https://github.com/huggingface/transformers.git"])
 
28
 
29
  # Load the pre-trained model and processor
30
  model_checkpoint = "microsoft/resnet-50"
31
+ model = AutoModelForImageClassification.from_pretrained(model_checkpoint, ignore_mismatched_sizes=True, num_labels=len(labels))
32
  image_processor = AutoImageProcessor.from_pretrained(model_checkpoint)
33
 
34
  # Define the image transformations
 
82
  # Evaluate the pre-trained model
83
  metrics = trainer.evaluate()
84
  print(metrics)
85
+