HaidarJomaa commited on
Commit
830e5ce
·
verified ·
1 Parent(s): 7a506f3

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +4 -6
  2. TabNet_model_4.sav +0 -0
  3. app.py +34 -0
  4. requirements.txt +5 -0
README.md CHANGED
@@ -1,13 +1,11 @@
1
  ---
2
- title: TabNet Kerato V2
3
- emoji: 💻
4
- colorFrom: yellow
5
- colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.12.0
8
  app_file: app.py
9
  pinned: false
10
- short_description: 4 way classification
11
  ---
12
-
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: TabNet_Kerato_v2
3
+ emoji: 📊
4
+ colorFrom: blue
5
+ colorTo: indigo
6
  sdk: gradio
7
  sdk_version: 5.12.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
TabNet_model_4.sav ADDED
Binary file (191 kB). View file
 
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib
3
+ from pytorch_tabnet.tab_model import TabNetClassifier
4
+ import sklearn
5
+ import numpy as np
6
+
7
+ file_name = 'TabNet_model_4.sav'
8
+ model_3 = joblib.load(file_name)
9
+
10
+ def TabNet(Z_00, Z_1M1, Z_1P1, Z_2M2, Z_20,
11
+ Z_2P2, Z_3M3, Z_3M1, Z_3P1, Z_3P3,
12
+ Z_4M4, Z_4M2, Z_40, Z_4P2, Z_4P4):
13
+
14
+ outcome_decoded = {0:"Normal", 1:"TBN", 2:"TBF", 3:"Keratoconic"}
15
+
16
+ X = [[Z_00, Z_1M1, Z_1P1, Z_2M2, Z_20,
17
+ Z_2P2, Z_3M3, Z_3M1, Z_3P1, Z_3P3,
18
+ Z_4M4, Z_4M2, Z_40, Z_4P2, Z_4P4]]
19
+ X = np.array(X)
20
+
21
+ result_4way = model_3.predict(X)
22
+ return 'The patient is ' + outcome_decoded[int(result_4way)] + '.'
23
+
24
+ iface = gr.Interface(
25
+ fn=TabNet,
26
+ title='TabNet Predictor',
27
+ description='This TabNet model is capable of detecting Keratoconus and Keratoconic suspects with high accuracy. It takes in all of the Zernike Polynomials with values 4 and below. This is the 4-way classification.\
28
+ The parameter Z_00 refers to z(0,0); Z_2P2 refers to z(2, +2); where P represents the Plus "+" and M represents the Minus "-"\
29
+ This version further subdivides the suspects into 2 groups.',
30
+ inputs=["number", "number", "number", "number", "number",
31
+ "number", "number", "number", "number", "number",
32
+ "number", "number", "number", "number", "number"],
33
+ outputs="text")
34
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio==5.12.0
2
+ scikit-learn
3
+ pytorch_tabnet
4
+ joblib==1.2.0
5
+ numpy