Spaces:
Sleeping
Sleeping
| 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() | |