| from fastai.vision.all import * |
| import gradio as gr |
|
|
|
|
| |
| learn = load_learner('export.pkl') |
|
|
| |
| labels = learn.dls.vocab |
|
|
|
|
| |
| def predict(img): |
| img = PILImage.create(img) |
| pred,pred_idx,probs = learn.predict(img) |
| return {labels[i]: float(probs[i]) for i in range(len(labels))} |
| |
| |
| title = "Blindness Classifier" |
| description = "A Diabetic Retinopathy disease (DR) classifier trained on a Retine Image dataset with fastai. It classifies 5 degrees in the advance of the disease ranging from: [0]-No DR, [1]-Mild DR, [2]-Moderate DR, [3]-Severe DR y [4]-Proliferative DR" |
| |
| |
| gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(320, 320)), outputs=gr.outputs.Label(num_top_classes=5), title=title, description=description, examples=['f576e45d1da2.png','1df0a4c23c95.png']).launch(share=False) |
| |
|
|