Ethium's picture
Update app.py
e3d027a verified
raw
history blame
No virus
568 Bytes
__all__ = ['is_glaucoma', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
from fastai.vision.all import *
import gradio as gr
def is_glaucoma(x): return x[0].isupper()
learn = load_learner('your_model.pkl')
categories = ('Glaucoma Present','Glaucoma Absent')
def predict(img):
pred,pred_idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
image = gr.inputs.Image(shape=(512,512))
label = gr.outputs.Label()
intf = gr.Interface(fn=predict, inputs=image, outputs=label)
intf.launch(inline=False)