minimal / app.py
m1969m's picture
Modified app.py: moved original app.py to app_v1.py and replaced it with image classifier code.
a8eba10
raw
history blame contribute delete
455 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pkl')
categories = ('cilantro', 'parsley')
def cilantro_o_perejil(image_file):
herb_predict,idx,probs = learn.predict(PILImage.create(image_file))
return dict(zip(categories, map(float,probs)))
examples = ["cilantro.jpg","parsley.jpg"]
gr.Interface(
fn=cilantro_o_perejil,
inputs="image",
outputs="label",
examples=examples
).launch(share=True)