File size: 806 Bytes
b61cbdb
51e5e3f
50b414a
b61cbdb
abdff05
0f0e13d
 
b61cbdb
6c4485f
b61cbdb
 
 
6c4485f
b61cbdb
 
 
657dd14
b61cbdb
b5b8d33
9b9b950
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from fastai.learner import load_learner
from transformers import AutoTokenizer, AutoModelForSequenceClassification

#learn = from_pretrained_fastai("edureyyy/MamographyClassifier/ModelSuperKek.pkl")
#learn = load_learner('edureyyy/MamographyClassifier/ModelSuperKek.pkl')
learn = load_learner('ModelSuperKek.pkl')

categories = ('Cancer', 'No Cancer')

def classificador(im):
    pred,idx,probs = learn.predict(im)
    return dict(zip(categories, map(float, probs)))

imatge = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
example = 'samples' #'archive/rsna22_bal/rsna22_bal/images_png' #['samples/12305_1995339680_L.png', 'samples/10234_173054723_L.png' ]

intf = gr.Interface(fn=classificador, inputs = imatge, outputs = label,examples=example)
intf.launch(inline=False)