edureyyy's picture
Update app.py
6cda211
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')
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 = ['/kaggle/input/rsna22-bal/rsna22_bal/rsna22_bal/images_png/12305_1995339680_L.png', '/kaggle/input/rsna22-bal/rsna22_bal/rsna22_bal/images_png/10234_173054723_L.png' ]
intf = gr.Interface(fn=classificador, inputs = imatge, outputs = label)
intf.launch(inline=False)