enio commited on
Commit
a019c7e
1 Parent(s): 3f53a42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -1,14 +1,11 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- pipeline = pipeline(task="image-classification", model="google/vit-base-patch16-224")
 
 
 
 
5
 
6
- def predict(image):
7
- predictions = pipeline(image)
8
- return {p["label"]: p["score"] for p in predictions}
9
-
10
- gr.Interface(
11
- predict,
12
- inputs=gr.inputs.Image(type="filepath"),
13
- outputs=gr.outputs.Label(num_top_classes=1),
14
- ).launch()
 
1
  import gradio as gr
 
2
 
3
+ examples = [
4
+ 'tiget.jpg',
5
+ 'teapot.jpg',
6
+ 'palace.jpg'
7
+ ]
8
 
9
+ gr.Interface.load(
10
+ "google/vit-base-patch16-224",
11
+ examples=examples).launch()