Spaces:
Runtime error
Runtime error
Changes to the algorithm
Browse files- Zernike_pipeline.pkl +2 -2
- app.py +24 -25
- stpi_data.txt +0 -0
Zernike_pipeline.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89b695a5df0e6f06fb59e74839858caebe63519a34dc676c7ed421a8d52cda3b
|
3 |
+
size 4584799
|
app.py
CHANGED
@@ -5,28 +5,26 @@ from joblib import load
|
|
5 |
file_name = 'Zernike_pipeline.pkl'
|
6 |
model = load(file_name)
|
7 |
|
|
|
|
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
print('------------------')
|
11 |
|
12 |
-
X = [z1,z2,z3,z4,z5,z6,z7]
|
13 |
print(X)
|
14 |
outcome_decoded = ['Normal','Borderline','Suspicious','Keratoconic']
|
15 |
-
file_object = open('zernike_data.txt', 'a')
|
16 |
-
file_object.write(str(z1))
|
17 |
-
file_object.write(';')
|
18 |
-
file_object.write(str(z2))
|
19 |
-
file_object.write(';')
|
20 |
-
file_object.write(str(z3))
|
21 |
-
file_object.write(';')
|
22 |
-
file_object.write(str(z4))
|
23 |
-
file_object.write(';')
|
24 |
-
file_object.write(str(z5))
|
25 |
-
file_object.write(';')
|
26 |
-
file_object.write(str(z6))
|
27 |
-
file_object.write(';')
|
28 |
-
file_object.write('\n')
|
29 |
-
file_object.close()
|
30 |
|
31 |
result = model.predict([X])
|
32 |
return 'The patient is ' + outcome_decoded[int(result)] + '.'
|
@@ -34,15 +32,16 @@ def Zernike(z1,z2,z3,z4,z5,z6,z7):
|
|
34 |
iface = gr.Interface(
|
35 |
fn=Zernike,
|
36 |
title='Awwad-Versaci Keratoconus Index',
|
37 |
-
description='The Awwad-Versaci Keratoconus Index (AVKI) detects keratoconus and keratoconus susceptible corneas through pachymetry maps centered on the thinnest point and fitted into Zernike polynomials. Beta version by Shady Awwad, Anthony Abou Mrad, MD, Jad Assaf, MD, and Francesco Versaci, PhD. This is the 4-way classification. The Zernke polynomials were taken from the 4mm cornea centered on the thinnest point
|
38 |
inputs=[
|
39 |
-
gr.inputs.Number(label=
|
40 |
-
gr.inputs.Number(label=
|
41 |
-
gr.inputs.Number(label=
|
42 |
-
gr.inputs.Number(label=
|
43 |
-
gr.inputs.Number(label=
|
44 |
-
gr.inputs.Number(label=
|
45 |
-
gr.inputs.Number(label=
|
|
|
46 |
],
|
47 |
outputs="text")
|
48 |
iface.launch(
|
|
|
5 |
file_name = 'Zernike_pipeline.pkl'
|
6 |
model = load(file_name)
|
7 |
|
8 |
+
# cols 6,7,10,13,18,20,23,30
|
9 |
+
indices = ['x', 'x', 'x', 'x', 'x', 'x', 'z(0,0)', 'z(1,-1)', 'z(1,+1)', 'z(2,-2)', 'z(2,0)', 'z(2,+2)', 'z(3,-3)', 'z(3,-1)', 'z(3,+1)', 'z(3,+3)', 'z(4,-4)', 'z(4,-2)', 'z(4,0)', 'z(4,+2)', 'z(4,+4)', 'z(5,-5)', 'z(5,-3)', 'z(5,-1)', 'z(5,+1)', 'z(5,+3)', 'z(5,+5)', 'z(6,-6)', 'z(6,-4)', 'z(6,-2)', 'z(6,0)', 'z(6,+2)', 'z(6,+4)', 'z(6,+6)', 'z(7,-7)', 'z(7,-5)', 'z(7,-3)', 'z(7,-1)', 'z(7,+1)', 'z(7,+3)', 'z(7,+5)', 'z(7,+7)']
|
10 |
|
11 |
+
# extract the columns
|
12 |
+
z1_label = indices[6]
|
13 |
+
z2_label = indices[7]
|
14 |
+
z3_label = indices[10]
|
15 |
+
z4_label = indices[13]
|
16 |
+
z5_label = indices[18]
|
17 |
+
z6_label = indices[20]
|
18 |
+
z7_label = indices[23]
|
19 |
+
z8_label = indices[30]
|
20 |
+
|
21 |
+
|
22 |
+
def Zernike(z1,z2,z3,z4,z5,z6,z7,z8):
|
23 |
print('------------------')
|
24 |
|
25 |
+
X = [z1,z2,z3,z4,z5,z6,z7,z8]
|
26 |
print(X)
|
27 |
outcome_decoded = ['Normal','Borderline','Suspicious','Keratoconic']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
result = model.predict([X])
|
30 |
return 'The patient is ' + outcome_decoded[int(result)] + '.'
|
|
|
32 |
iface = gr.Interface(
|
33 |
fn=Zernike,
|
34 |
title='Awwad-Versaci Keratoconus Index',
|
35 |
+
description='The Awwad-Versaci Keratoconus Index (AVKI) detects keratoconus and keratoconus susceptible corneas through pachymetry maps centered on the thinnest point and fitted into Zernike polynomials. Beta version by Shady Awwad, Anthony Abou Mrad, MD, Jad Assaf, MD, and Francesco Versaci, PhD. This is the 4-way classification. The Zernke polynomials were taken from the 4mm cornea centered on the thinnest point and selected from highest ROC curves',
|
36 |
inputs=[
|
37 |
+
gr.inputs.Number(label=z1_label),
|
38 |
+
gr.inputs.Number(label=z2_label),
|
39 |
+
gr.inputs.Number(label=z3_label),
|
40 |
+
gr.inputs.Number(label=z4_label),
|
41 |
+
gr.inputs.Number(label=z5_label),
|
42 |
+
gr.inputs.Number(label=z6_label),
|
43 |
+
gr.inputs.Number(label=z7_label),
|
44 |
+
gr.inputs.Number(label=z8_label)
|
45 |
],
|
46 |
outputs="text")
|
47 |
iface.launch(
|
stpi_data.txt
DELETED
File without changes
|