File size: 1,782 Bytes
6b54518
 
 
 
 
 
 
 
 
 
 
 
 
 
77c8fd3
6b54518
d28f057
c12ca31
d28f057
1785714
04baa87
33f3c7e
c21b1da
04baa87
08e8e27
d19855c
6b54518
 
 
 
 
 
 
 
 
c2f283d
07997b2
5300c2e
351a458
6b54518
 
19b4e68
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Version 1.0. Copyright Colleen Mahr 2025

import gradio as gr
from fastai.vision.all import *
import skimage

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 = "Cornea Ulcer Image Classifier"
description = "Version 1.0.  Copyright Colleen Mahr 2025"
article_text = "This machine learning image classifier was trained on publicly available external eye photos "
article_text = article_text +  "beginning with the ResNet152 convolutional neural network (https://arxiv.org/abs/1512.03385) pre-trained foundation."
article_text = article_text + "It is not medical advice.  If you have medical concerns, seek professional medical help immediately.  "
article_text = article_text + "You can upload an external eye photo and it will return an AI prediction of the probability of "
article_text = article_text + "a corneal ulcer being present.  This AI cornea ulcer classifier has 97% accuracy on both training and previously unseen test images."
article_text = article_text + "Here is a link to additional information about corneal ulcers:  "
article_text = article_text + "www.aao.org/eye-health/diseases/corneal-ulcer "

article = article_text
examples = ['examplecorneaulcer.jpeg','exampleconjunctivitisnocorneaulcer.jpeg','examplenormaleye.jpeg']
interpretation = 'default'
enable_queue = True

demo = gr.Interface(
    fn=predict,
    inputs=gr.Image(height = 512, width = 512),
    outputs=gr.Label(num_top_classes=2),
    title=title,
    description=description,
    article=article,
    examples=examples,
    #interpretation='default',
    #enable_queue=enable_queue
)

demo.launch(share = True)