Dhahlan2000 commited on
Commit
13a5c69
·
verified ·
1 Parent(s): d25040c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -4,8 +4,8 @@ from transformers import ViTForImageClassification, ViTFeatureExtractor
4
  from PIL import Image
5
 
6
  # Load model and feature extractor
7
- model = ViTForImageClassification.from_pretrained('Dhahlan2000/fruit_and_veg_chategorizer', num_labels=10, ignore_mismatched_sizes=True)
8
- feature_extractor = ViTFeatureExtractor.from_pretrained('Dhahlan2000/fruit_and_veg_chategorizer')
9
 
10
  # Move to GPU if available
11
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -14,16 +14,8 @@ model.eval()
14
 
15
  # Class labels (modify according to your model)
16
  class_labels = [
17
- "Apple",
18
- "Banana",
19
- "Bellpepper",
20
- "Carrot",
21
- "Cucumber",
22
- "Potato",
23
- "Tomato",
24
- "mango",
25
- "oranges",
26
- "strawberry"
27
  ]
28
 
29
  def predict_freshness(image):
 
4
  from PIL import Image
5
 
6
  # Load model and feature extractor
7
+ model = ViTForImageClassification.from_pretrained('shahmi0519/mango_artificial', num_labels=10, ignore_mismatched_sizes=True)
8
+ feature_extractor = ViTFeatureExtractor.from_pretrained('shahmi0519/mango_artificial')
9
 
10
  # Move to GPU if available
11
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
14
 
15
  # Class labels (modify according to your model)
16
  class_labels = [
17
+ "Artificial",
18
+ "Natural"
 
 
 
 
 
 
 
 
19
  ]
20
 
21
  def predict_freshness(image):