Spaces:
Runtime error
Runtime error
JadAssaf
commited on
Commit
•
e49cbdd
1
Parent(s):
0529602
Initial
Browse files- .DS_Store +0 -0
- Zernike_pipeline.pkl +3 -0
- app.py +52 -0
- requirements.txt +5 -0
- stpi_data.txt +0 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
Zernike_pipeline.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:37ae8f3a37f70e547d8326f272d0bee86c05e81f1bb9c9eb305162dd9d19d18b
|
3 |
+
size 4518575
|
app.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# %%
|
2 |
+
import gradio as gr
|
3 |
+
from joblib import load
|
4 |
+
|
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('stpi_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_3way = model.predict([X])
|
32 |
+
return 'The patient is ' + outcome_decoded[int(result_3way)] + '.'
|
33 |
+
|
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 2mm 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=["number", "number","number", "number", "number","number"],
|
39 |
+
inputs=[
|
40 |
+
gr.inputs.Number(label="z(0,0)"),
|
41 |
+
gr.inputs.Number(label="z(1,-1)"),
|
42 |
+
gr.inputs.Number(label="z(2,0)"),
|
43 |
+
gr.inputs.Number(label="z(3,-1)"),
|
44 |
+
gr.inputs.Number(label="z(4,0)"),
|
45 |
+
gr.inputs.Number(label="z(6,0)"),
|
46 |
+
gr.inputs.Number(label="z(7,-1)")
|
47 |
+
],
|
48 |
+
outputs="text")
|
49 |
+
iface.launch(
|
50 |
+
# share=True
|
51 |
+
)
|
52 |
+
# %%
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio==3.15.0
|
2 |
+
joblib==1.2.0
|
3 |
+
numpy==1.24.2
|
4 |
+
pandas==2.0.2
|
5 |
+
scikit_learn==1.2.2
|
stpi_data.txt
ADDED
File without changes
|