File size: 862 Bytes
804d2ec
 
 
 
4280a69
804d2ec
4280a69
 
dfd8178
4280a69
 
804d2ec
4280a69
 
 
 
 
 
1609e16
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#                                                                                                                 
# gradio demo                                                                                                     
#                                                                                                                 
import gradio as gr
from transformers import ViTFeatureExtractor, ViTModel

feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-base-patch16-224-in21k')
model = ViTModel.from_pretrained('akahana/vit-base-cats-vs-dogs')

title = "Sandbox"
description = "Place to try various models"

def classify(image):
    inputs = feature_extractor(images=image, return_tensors="pt")
    outputs = model(**inputs)
    return "dog"
    
demo = gr.Interface(fn=classify, inputs="image", outputs="text")

demo.launch()