File size: 521 Bytes
259b3d1
 
 
2490569
788f0c1
 
2490569
3cea84f
 
2490569
788f0c1
2490569
821f795
2490569
 
 
afae258
54d96bf
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from transformers import pipeline
import gradio as gr

# Load image classification pipeline from Hugging Face Transformers
image_classifier = pipeline("image-classification")

# Define a function for image classification using Gradio
def classify_image(image):
    result = image_classifier(image)
    return result[0]['label']  # Return the label of the top prediction

# Create a Gradio interface
iface = gr.Interface(fn=classify_image, inputs="image", outputs="label")

# Launch the Gradio interface
iface.launch()