| from fastai.vision.all import * | |
| import gradio as gr | |
| import skimage | |
| learn = load_learner('model.pkl') | |
| categories = ('Normal', 'Cancer') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = gr.inputs.Image() | |
| label = gr.outputs.Label() | |
| examples = ['Cancer.png'] | |
| interpretation='default' | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, interpretation=interpretation) | |
| intf.launch() |