Commented local_model_path variable since it's no longer needed.
This commit is contained in:
+1
-3
@@ -5,14 +5,13 @@ from transformers import ViTImageProcessor, ViTForImageClassification
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Specify the local directory where the model files are stored
|
# Specify the local directory where the model files are stored
|
||||||
local_model_path = '/home/overnion/Status200/models/pretrained'
|
#local_model_path = './pretrained'
|
||||||
|
|
||||||
# Check if the image path is provided
|
# Check if the image path is provided
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Error: No image path provided. Please provide the path to the image as an argument.")
|
print("Error: No image path provided. Please provide the path to the image as an argument.")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
# Load the image processor and model
|
# Load the image processor and model
|
||||||
model_name = 'vishnun0027/Crop_Disease_model_1'
|
model_name = 'vishnun0027/Crop_Disease_model_1'
|
||||||
image_processor = ViTImageProcessor.from_pretrained(model_name)
|
image_processor = ViTImageProcessor.from_pretrained(model_name)
|
||||||
@@ -48,4 +47,3 @@ predicted_class_idx = logits.argmax(-1).item()
|
|||||||
|
|
||||||
# Print the predicted class
|
# Print the predicted class
|
||||||
print(model.config.id2label[predicted_class_idx])
|
print(model.config.id2label[predicted_class_idx])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user