Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
from fastai.data.external import * | |
import gradio as gr | |
learn = load_learner('lung.pkl') | |
categories = ('ACA', 'Benign', 'SCC') | |
def classify_image(img): | |
pred,idx,probs = learn.predict(img) | |
return dict(zip(categories, map(float,probs))) | |
image = gr.components.Image(shape=(768, 768)) | |
label = gr.components.Label() | |
examples = ['lungaca.jpeg', 'lungaca142.jpeg', 'lungaca199.jpeg', 'lungaca861.jpeg', | |
'lungn.jpeg', 'lungn159.jpeg', 'lungn380.jpeg', 'lungn633.jpeg', | |
'lungscc.jpeg', 'lungscc958.jpeg', 'lungscc626.jpeg', 'lungscc344.jpeg'] | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
intf.launch(inline=False) |