File size: 483 Bytes
34c60e1
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastai.vision.all import *
import gradio as gr
import pathlib
learn = load_learner('model.pkl')
categories = ('Empty','Healthy', 'Wilted')

def classify_img(img):
    pred, idx, probs = learn.predict(img)
    return dict(zip(categories, map(float,probs)))

image = gr.Image(shape=(192,192))
label = gr.Label()
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples= ['healthy_hydro_kale.jpg', 'wilted_plant.jpg', 'empty_trays.jpg'])
intf.launch(inline=False)