Ant commited on
Commit
3833f6b
1 Parent(s): 01a19c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -17
app.py CHANGED
@@ -1,19 +1,5 @@
1
- import transformers
2
- from transformers import ViTModel, ViTImageProcessor
3
- from PIL import Image
4
  import gradio as gr
5
 
6
-
7
- model = ViTModel.from_pretrained("afern24/vit-beans-finetuned")
8
- processor = ViTImageProcessor.from_pretrained('google/vit-base-patch16-224-in21k')
9
-
10
- def classify_image(image):
11
- inputs = processor(images=image, return_tensors="pt")
12
- outputs = model(**inputs)
13
- return outputs
14
-
15
- # Define your examples as a list of lists
16
- examples = [["leaf1.jpg"], ["leaf2.jpg"], ["leaf3.jpg"]]
17
-
18
- # Load your interface with examples
19
- gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs=gr.outputs.Label, examples=examples).launch(debug=True)
 
 
 
 
1
  import gradio as gr
2
 
3
+ gr.Interface.load(
4
+ "afern24/vit-beans-finetuned",
5
+ examples=["leaf1.jpg", "leaf2.jpg", "leaf3.jpg"]).launch()