| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner("export.pkl") | |
| categories = ("Benign", "Malignant") | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = gr.Image() | |
| label = gr.Label() | |
| examples = ['benign.jpg','malignant.jpg'] | |
| title = 'Skin Cancer Predictor' | |
| description = 'This app predicts skin cancer. For reference only.' | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title=title, description=description) | |
| intf.launch(inline=False) | |