Spaces:
Sleeping
Sleeping
added save
Browse files- app.py +20 -0
- glaucoma.png +0 -0
- model2.pkl +3 -0
- not glaucoma.png +0 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def is_glaucoma(x): return x[6] == 'g'
|
5 |
+
|
6 |
+
learn = load_learner('model2.pkl')
|
7 |
+
|
8 |
+
categories = ('Glaucoma', 'not Glaucoma')
|
9 |
+
|
10 |
+
def classify_image(img):
|
11 |
+
pred,idx,probs = learn.predict(img)
|
12 |
+
return dict(zip(categories, map(float,probs)))
|
13 |
+
|
14 |
+
image = gr.components.Image(height=192, width=192)
|
15 |
+
label = gr.components.Label()
|
16 |
+
examples = ['glaucoma.jpg', 'not glaucoma.jpg']
|
17 |
+
|
18 |
+
|
19 |
+
intf=gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
20 |
+
intf.launch(inline=False)
|
glaucoma.png
ADDED
![]() |
model2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d5853853f94517f360a04b4891283a195440f25d5e8745e815d552c563744d7
|
3 |
+
size 46968333
|
not glaucoma.png
ADDED
![]() |