| 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) | |