Spaces:
Runtime error
Runtime error
Remove augmentation
#1
by
alvanlii
- opened
app.py
CHANGED
@@ -22,15 +22,8 @@ def classify_image(inp):
|
|
22 |
# Preprocess
|
23 |
model_preprocessor_name = "google/vit-base-patch16-224"
|
24 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_preprocessor_name)
|
25 |
-
|
26 |
-
|
27 |
-
ColorJitter(brightness=0.25, contrast=0.25, saturation=0.25, hue=0.4),
|
28 |
-
RandomPerspective(distortion_scale=0.3),
|
29 |
-
ToTensor(),
|
30 |
-
]
|
31 |
-
)
|
32 |
-
|
33 |
-
inp = np.array(augs(inp.convert('RGB')))
|
34 |
|
35 |
inp = torch.tensor(feature_extractor(images=inp)['pixel_values'])
|
36 |
preds = model(inp)['logits']
|
|
|
22 |
# Preprocess
|
23 |
model_preprocessor_name = "google/vit-base-patch16-224"
|
24 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_preprocessor_name)
|
25 |
+
|
26 |
+
inp = np.array(inp.convert('RGB'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
inp = torch.tensor(feature_extractor(images=inp)['pixel_values'])
|
29 |
preds = model(inp)['logits']
|