Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
+
|