Ashish08 commited on
Commit
b61c48d
1 Parent(s): 3335623

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import torch
3
- from transformers import AutoFeatureExtractor, AutoModelForImageClassification, ViTImageProcessor
4
 
5
  image_processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224")
6
 
@@ -10,8 +10,8 @@ model = AutoModelForImageClassification.from_pretrained("saved_model_files")
10
  labels = ['angular_leaf_spot', 'bean_rust', 'healthy']
11
 
12
 
13
- def classify(im):
14
- features = image_processor(im, return_tensors='pt')
15
  logits = model(features["pixel_values"])[-1]
16
  probability = torch.nn.functional.softmax(logits, dim=-1)
17
  probs = probability[0].detach().numpy()
 
1
  import gradio as gr
2
  import torch
3
+ from transformers import ViTImageProcessor, AutoFeatureExtractor, AutoModelForImageClassification
4
 
5
  image_processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224")
6
 
 
10
  labels = ['angular_leaf_spot', 'bean_rust', 'healthy']
11
 
12
 
13
+ def classify(image):
14
+ features = image_processor(image, return_tensors='pt')
15
  logits = model(features["pixel_values"])[-1]
16
  probability = torch.nn.functional.softmax(logits, dim=-1)
17
  probs = probability[0].detach().numpy()