fastai-bears / app.py
Devon Artis
Update app.py
c90e47e
raw
history blame contribute delete
No virus
478 Bytes
import gradio as gr
#def greet(name):
# return "Hello " + name + "!"
def on_click_classify(change):
img = PILImage.create(btn_upload.data[-1])
out_pl.clear_output()
with out_pl: display(img.to_thumb(128,128))
pred,pred_idx,probs = learn_inf.predict(img)
lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'
btn_run.on_click(on_click_classify)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()