File size: 917 Bytes
f2ea792
 
7463538
f2ea792
 
7463538
f2ea792
 
f69cd04
f2ea792
b028f72
 
f69cd04
f2ea792
 
 
 
 
 
7463538
f2ea792
7463538
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
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()