Xin Liu
sample
b5b8d33 unverified
raw
history blame
741 Bytes
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')
label = ['Cancer', 'No Cancer']
def classificador(im):
pred,idx,probs = learn.predict(im)
return dict(zip(label, map(float, probs)))
imatge = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
example = ['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)