File size: 528 Bytes
e85ca59 ea23e2f 1c2e5c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |