Greens / app.py
Mahmoud22's picture
Update app.py
ea23e2f verified
raw
history blame
528 Bytes
import os
os.system('pip install -r tmp/requirements.txt')
from fastai.vision.all import load_learner
import gradio as gr
# Load the model
model_path = "convnext_model/convnext_model.pkl"
learn = load_learner(model_path)
# Prediction function
def predict(image):
pred, _, probs = learn.predict(image)
return pred
# Gradio interface
iface = gr.Interface(
fn=predict,
inputs="image",
outputs="label",
title="Greens classifier",
description="Dill, Parsley, Coriander or Watercress?"
)
iface.launch()