beingamit99 commited on
Commit
1e1dc8c
·
1 Parent(s): 930548c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -36,15 +36,15 @@ import numpy as np
36
  from PIL import Image
37
  from transformers import AutoImageProcessor, AutoModelForImageClassification
38
 
39
- # Load the model and image processor
40
  processor = AutoImageProcessor.from_pretrained("beingamit99/car_damage_detection")
41
  model = AutoModelForImageClassification.from_pretrained("beingamit99/car_damage_detection")
42
 
43
- # Load and process the image
44
  image = Image.open(IMAGE)
45
  inputs = processor(images=image, return_tensors="pt")
46
 
47
- # Make predictions
48
  outputs = model(**inputs)
49
  logits = outputs.logits.detach().cpu().numpy()
50
  predicted_class_id = np.argmax(logits)
@@ -52,7 +52,7 @@ predicted_proba = np.max(logits)
52
  label_map = model.config.id2label
53
  predicted_class_name = label_map[predicted_class_id]
54
 
55
- # Print the results
56
  print(f"Predicted class: {predicted_class_name} (probability: {predicted_proba:.4f})")
57
  </code>
58
 
@@ -60,7 +60,7 @@ print(f"Predicted class: {predicted_class_name} (probability: {predicted_proba:.
60
  <code>
61
  from transformers import pipeline
62
 
63
- # Create a classification pipeline
64
  pipe = pipeline("image-classification", model="beingamit99/car_damage_detection")
65
  pipe(IMAGE)
66
  </code>
 
36
  from PIL import Image
37
  from transformers import AutoImageProcessor, AutoModelForImageClassification
38
 
39
+ #Load the model and image processor
40
  processor = AutoImageProcessor.from_pretrained("beingamit99/car_damage_detection")
41
  model = AutoModelForImageClassification.from_pretrained("beingamit99/car_damage_detection")
42
 
43
+ #Load and process the image
44
  image = Image.open(IMAGE)
45
  inputs = processor(images=image, return_tensors="pt")
46
 
47
+ #Make predictions
48
  outputs = model(**inputs)
49
  logits = outputs.logits.detach().cpu().numpy()
50
  predicted_class_id = np.argmax(logits)
 
52
  label_map = model.config.id2label
53
  predicted_class_name = label_map[predicted_class_id]
54
 
55
+ #Print the results
56
  print(f"Predicted class: {predicted_class_name} (probability: {predicted_proba:.4f})")
57
  </code>
58
 
 
60
  <code>
61
  from transformers import pipeline
62
 
63
+ #Create a classification pipeline
64
  pipe = pipeline("image-classification", model="beingamit99/car_damage_detection")
65
  pipe(IMAGE)
66
  </code>