File size: 2,615 Bytes
6b54518
 
 
 
 
 
 
 
 
 
 
 
 
 
77c8fd3
e6bbb19
d28f057
c12ca31
d28f057
1785714
04baa87
33f3c7e
c21b1da
08e8e27
7b1d15e
7e94a64
d19855c
6b54518
 
 
 
 
 
 
 
 
7e94a64
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
43
# 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 - Rochester, MN STEM Fair"
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
html_article = "<div><p>This machine learning image classifier was trained on publicly available external eye photos beginning with the ResNet152 convolutional neural network (<a href='https://arxiv.org/abs/1512.03385'>https://arxiv.org/abs/1512.03385</a>) pre-trained foundation.  It is not medical advice. If you have medical concerns, seek professional medical help immediately. You can upload an external eye photo and it will return an AI prediction of the probability of a corneal ulcer being present. This AI cornea ulcer classifier has 97% accuracy on both training and previously unseen test images.  Here is a link to additional information about corneal ulcers:&nbsp;<a href='http://www.aao.org/eye-health/diseases/corneal-ulcer'>www.aao.org/eye-health/diseases/corneal-ulcer</a></p></div>"

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=html_article,
    examples=examples,
    #interpretation='default',
    #enable_queue=enable_queue
)

demo.launch(share = True)