Mishmosh's picture
Update app.py
3cea84f
raw
history blame
520 Bytes
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="text")
# Launch the Gradio interface
iface.launch()