plant_analyzer / app.py
chimithecat's picture
mbuihr
ca265db
raw
history blame
649 Bytes
import gradio as gr
from transformers import pipeline
from PIL import Image
# Load your model
model = pipeline("image-classification", model="wellCh4n/tomato-leaf-disease-classification-vit")
def classify(image):
if not isinstance(image, Image.Image):
image = Image.fromarray(image)
result = model(image)
return result[0]['label']
# Define the interface
app = gr.Interface(
fn=classify,
inputs=gr.Image(type="pil"),
outputs="label",
title="Tomato Leaf Disease Analyzer",
description="Upload a tomato leaf image to detect the disease."
)
# ✅ Disable SSR to enable API correctly
app.launch(show_api=True)