import gradio as gr from transformers import pipeline from PIL import Image classifier = pipeline("image-classification", model="microsoft/resnet-50") def classify(image): results = classifier(image) top = results[0] label = top['label'] score = round(top['score'] * 100, 2) return f"{label} ({score}%)" gr.Interface(fn=classify, inputs=gr.Image(type="pil"), outputs="text", title="Cat Classifier").launch()