File size: 742 Bytes
430b6a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2eea718
430b6a5
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)