Spaces:
Sleeping
Sleeping
File size: 564 Bytes
259b3d1 2490569 788f0c1 2490569 3cea84f cb33233 3cea84f cb33233 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 21 22 23 |
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):
print(f"Received image: {image}")
result = image_classifier(image)
print(f"Classification result: {result}")
return result[0]['label']
# Create a Gradio interface
iface = gr.Interface(fn=classify_image, inputs="image", outputs="label")
# Launch the Gradio interface
iface.launch()
|