JadAssaf commited on
Commit
ae1ffe3
1 Parent(s): bb1c225

Changes to the algorithm

Browse files
Files changed (3) hide show
  1. Zernike_pipeline.pkl +2 -2
  2. app.py +24 -25
  3. 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:37ae8f3a37f70e547d8326f272d0bee86c05e81f1bb9c9eb305162dd9d19d18b
3
- size 4518575
 
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
- def Zernike(z1,z2,z3,z4,z5,z6,z7):
 
 
 
 
 
 
 
 
 
 
 
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 the selected polynomials are z(0,0) z(1,-1) z(2,0) z(3,-1) z(4,0) z(6,0) z(7,-1) from highest ROC curves',
38
  inputs=[
39
- gr.inputs.Number(label="z(0,0)"),
40
- gr.inputs.Number(label="z(1,-1)"),
41
- gr.inputs.Number(label="z(2,0)"),
42
- gr.inputs.Number(label="z(3,-1)"),
43
- gr.inputs.Number(label="z(4,0)"),
44
- gr.inputs.Number(label="z(6,0)"),
45
- gr.inputs.Number(label="z(7,-1)")
 
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