JadAssaf commited on
Commit
0f09a05
β€’
1 Parent(s): 160a26f
Files changed (7) hide show
  1. .DS_Store +0 -0
  2. .gitignore +1 -0
  3. README.md +31 -6
  4. STPI_3WAY_RandomForest.joblib +3 -0
  5. app.py +57 -0
  6. requirements.txt +3 -0
  7. stpi_data.txt +1 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ MISC/
README.md CHANGED
@@ -1,12 +1,37 @@
1
  ---
2
- title: TSPIzeimer2
3
- emoji: πŸƒ
4
- colorFrom: red
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 3.0.24
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: STPIzeimer
3
+ emoji: πŸ‘€
4
+ colorFrom: purple
5
+ colorTo: green
6
  sdk: gradio
 
7
  app_file: app.py
8
  pinned: false
9
  ---
10
 
11
+ # Configuration
12
+
13
+ `title`: _string_
14
+ Display title for the Space
15
+
16
+ `emoji`: _string_
17
+ Space emoji (emoji-only character allowed)
18
+
19
+ `colorFrom`: _string_
20
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
+
22
+ `colorTo`: _string_
23
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
+
25
+ `sdk`: _string_
26
+ Can be either `gradio` or `streamlit`
27
+
28
+ `sdk_version` : _string_
29
+ Only applicable for `streamlit` SDK.
30
+ See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
+
32
+ `app_file`: _string_
33
+ Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
+ Path is relative to the root of the repository.
35
+
36
+ `pinned`: _boolean_
37
+ Whether the Space stays on top of your list.
STPI_3WAY_RandomForest.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e44d33f4a94990903d888315af904467280eb7aa74982a0fcc158604ea579700
3
+ size 308096
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # %%
2
+ import gradio as gr
3
+ import joblib
4
+ loaded_rf_3way = joblib.load("STPI_3WAY_RandomForest.joblib")
5
+
6
+
7
+ def STPI(t_0_5_MaxValue,t_1_0_MaxValue,t_2_0_MaxValue,
8
+ # Acc_0_5__1_0_MaxValue,
9
+ Abs_Diff_t_0_5_MaxValue,Abs_Diff_t_1_0_MaxValue,Abs_Diff_t_2_0_MaxValue):
10
+ print('------------------')
11
+
12
+ X = [t_0_5_MaxValue,t_1_0_MaxValue,t_2_0_MaxValue,
13
+ # Acc_0_5__1_0_MaxValue,
14
+ Abs_Diff_t_0_5_MaxValue,Abs_Diff_t_1_0_MaxValue,Abs_Diff_t_2_0_MaxValue]
15
+ print(X)
16
+ outcome_decoded = ['Normal','Suspect','Keratoconic']
17
+ file_object = open('stpi_data.txt', 'a')
18
+ file_object.write(str(t_0_5_MaxValue))
19
+ file_object.write(';')
20
+ file_object.write(str(t_1_0_MaxValue))
21
+ file_object.write(';')
22
+ file_object.write(str(t_2_0_MaxValue))
23
+ file_object.write(';')
24
+ # file_object.write(str(Acc_0_5__1_0_MaxValue))
25
+ # file_object.write(';')
26
+ file_object.write(str(Abs_Diff_t_0_5_MaxValue))
27
+ file_object.write(';')
28
+ file_object.write(str(Abs_Diff_t_1_0_MaxValue))
29
+ file_object.write(';')
30
+ file_object.write(str(Abs_Diff_t_2_0_MaxValue))
31
+ file_object.write(';')
32
+ file_object.write('\n')
33
+ file_object.close()
34
+
35
+ result_3way = loaded_rf_3way.predict([X])
36
+ print('The patient is ', outcome_decoded[int(result_3way)], 'through the 3way method')
37
+ # result = 'The 3-way classification resulted in a ', outcome_decoded[int(result_3way)] + ' patient.'
38
+ # further_analysis = 'Futher analysis using the 2-way classification resulted in a ' + outcome_decoded[int(result_2way)] + ' label.'
39
+ return 'The patient is ' + outcome_decoded[int(result_3way)] + '.'
40
+
41
+ # result = 'The 2-way classification resulted in a ', outcome_decoded[int(result_2way)] + ' patient.'
42
+ # further_analysis = 'Futher analysis using the 3-way classification resulted in a ' + outcome_decoded[int(result_3way)] + ' label.'
43
+
44
+ return 'The patient is ' + outcome_decoded[int(result_2way)] + '.'
45
+
46
+ iface = gr.Interface(
47
+ fn=STPI,
48
+ title='TSPI Calculator',
49
+ description='Uses the Thickness Speed Progression Index (TSPI) to calculate the most probable patient diagnosis through summarized tomographic parameters. Beta version made for Zeimer by Prof. Shady Awwad and Jad Assaf MD.',
50
+ inputs=["number", "number","number",
51
+ # "number",
52
+ "number", "number","number"],
53
+ outputs="text")
54
+ iface.launch(
55
+ # share=True
56
+ )
57
+ # %%
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==2.4.6
2
+ joblib==1.0.0
3
+ scikit-learn==0.24.0
stpi_data.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 11.0;22.0;33.0;44.0;55.0;66.0;77.0