Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Initialize the image classification pipeline | |
| pipe = pipeline("image-classification", model="eligapris/v-mdd-2000-150") | |
| def classify_image(image): | |
| # Perform image classification | |
| results = pipe(image) | |
| # Format the results | |
| output = "" | |
| for result in results: | |
| output += f"Label: {result['label']}, Score: {result['score']:.4f}\n" | |
| return output | |
| # Create the Gradio interface | |
| iface = gr.Interface( | |
| fn=classify_image, | |
| inputs=gr.Image(type="pil"), | |
| outputs="text", | |
| title="Classifier for Corn Leaf Diseases", | |
| description="Upload an image to classify it using the eligapris/v-mdd-2000-150 model." | |
| ) | |
| # Launch the app | |
| iface.launch(share=True) |