marii/study_group_example
0
1# AUTOGENERATED! DO NOT EDIT! File to edit: 00_app.ipynb (unless otherwise specified).2 3__all__ = ['learn', 'predict', 'labels']4 5# Cell6learn = load_learner('export.pkl')7 8# Cell9labels = learn.dls.vocab10def predict(img):11 img = PILImage.create(img)12 pred,pred_idx,probs = learn.predict(img)13 14 return {labels[i]: float(probs[i]) for i in range(len(labels))}15 16# Cell17import gradio as gr18gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)