import gradio as gr | |
from fastai.vision.all import * | |
learn_inf = load_learner('export.pkl') | |
def greet(image): | |
pred,pred_idx,probs = learn_inf.predict(image) | |
return f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}' | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
iface = gr.Interface(fn=greet, inputs=image, outputs=label) | |
iface.launch() |