File size: 632 Bytes
b3fe980
 
 
 
c790375
b3fe980
 
c790375
b3fe980
 
 
 
c790375
b3fe980
 
 
 
c790375
 
b3fe980
 
c790375
b3fe980
c790375
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()