aiiproject2 / app.py
Haseeb005's picture
Create app.py
39948d6 verified
Raw History Blame Contribute Delete
546 Bytes
import gradio as gr
import joblib # or torch, tensorflow, etc.
import numpy as np
from PIL import Image
model = joblib.load("model.pkl") # Replace with your model
def predict(image):
# Preprocess image
img_array = np.array(image.resize((224, 224))) / 255.0
img_array = img_array.reshape(1, 224, 224, 3)
# Predict
prediction = model.predict(img_array)
return f"Disease: {prediction[0]}"
gr.Interface(
fn=predict,
inputs=gr.Image(type="pil"),
outputs="text",
title="Plant Disease Detector",
).launch()