import gradio as gr from fastai.vision.all import * from tools import * import skimage learn = load_learner('panda-model-1.pkl') labels = learn.dls.vocab def predict(img): print(type(img)) print(img.shape) img = get_crops(PILImage.create(img)) pred,pred_idx,probs = learn.predict(img) return {labels[i]: float(probs[i]) for i in range(len(labels))} title = "Prostate cANcer graDe Assessment model" description = "A model to predict the ISUP grade for prostate cancer based on whole-slide images of digitized H&E-stained biopsies." # article="

Blog post

" examples = ['example.jpg', 'example2.jpg', 'example3.jpg'] gr.Interface(fn=predict,inputs=gr.inputs.Image(),outputs=gr.outputs.Label(num_top_classes=5),title=title,description=description,examples=examples).launch()