Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def suppress_stdout():
|
|
26 |
# Load the saved model and suppress the warnings
|
27 |
with suppress_stdout():
|
28 |
model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224-in21k', num_labels=6)
|
29 |
-
model.load_state_dict(torch.load('
|
30 |
model.eval()
|
31 |
|
32 |
# Define the same transformation used during training
|
@@ -58,6 +58,6 @@ def predict_disease(image_path):
|
|
58 |
return predicted_label
|
59 |
|
60 |
# Test with a new image
|
61 |
-
image_path = '
|
62 |
predicted_label = predict_disease(image_path)
|
63 |
print(f'The predicted disease type is: {predicted_label}')
|
|
|
26 |
# Load the saved model and suppress the warnings
|
27 |
with suppress_stdout():
|
28 |
model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224-in21k', num_labels=6)
|
29 |
+
model.load_state_dict(torch.load('vit_sugarcane_disease_detection.pth'))
|
30 |
model.eval()
|
31 |
|
32 |
# Define the same transformation used during training
|
|
|
58 |
return predicted_label
|
59 |
|
60 |
# Test with a new image
|
61 |
+
image_path = 'zoomed_Bacterial%20Blight_614.png' # Replace with your image path
|
62 |
predicted_label = predict_disease(image_path)
|
63 |
print(f'The predicted disease type is: {predicted_label}')
|