moro23's picture
Added application file
2c7539c
raw
history blame
483 Bytes
from fastbook import *
import gradio as gr
## lets load the model
learn_inf = load_learner(path/'bear_classifier_cat')
def bear_classifier(image):
pred,pred_idx,probs = learn_inf.predict(image)
pred_name = f'Prediction: {pred}'
pred_prob = f'Probability: {probs[pred_idx]:.04f}'
return image, pred_name, pred_prob
iface = gr.Interface(fn=bear_classifier, inputs=gr.inputs.Image(shape=(224, 224)), \
outputs=["text", "number"])
iface.launch(inline=False)