alexguimenti's picture
Update interface and code to english
c790375 verified
raw
history blame contribute delete
632 Bytes
from transformers import pipeline
import gradio as gr
from PIL import Image
# Load dog breed classification model
pipe = pipeline("image-classification", model="jhoppanne/Dogs-Breed-Image-Classification-V1")
# Function to be used in Gradio
def dog_breed_classifier(image):
results = pipe(image)
return {res["label"]: res["score"] for res in results}
# Gradio Interface
iface = gr.Interface(
fn=dog_breed_classifier,
inputs=gr.Image(type="pil"),
outputs=gr.Label(num_top_classes=3),
title="Dog Breed Classifier",
description="Upload a dog image to identify its breed."
)
# Run the app
iface.launch()