JadAssaf commited on
Commit
203a444
·
1 Parent(s): 59acec4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -2,7 +2,7 @@
2
  import gradio as gr
3
  import joblib
4
  import dill
5
- import pickle
6
  import imblearn
7
  import sklearn
8
  import xgboost
@@ -10,36 +10,36 @@ file_name = 'TSPI_model_joblib.sav'
10
  model = joblib.load(file_name)
11
 
12
 
13
- def STPI(t_1_MaxValue,t_2_MaxValue,t_4_MaxValue,
14
  # Acc_0_5__1_0_MaxValue,
15
- Abs_Diff_t_1_MaxValue,Abs_Diff_t_2_MaxValue,Abs_Diff_t_4_MaxValue):
16
  print('------------------')
17
 
18
- X = [t_1_MaxValue,t_2_MaxValue,t_4_MaxValue,
19
  # Acc_0_5__1_0_MaxValue,
20
- Abs_Diff_t_1_MaxValue,Abs_Diff_t_2_MaxValue,Abs_Diff_t_4_MaxValue]
21
  print(X)
22
- outcome_decoded = ['Normal',,'Suspect','Keratoconic']
23
  file_object = open('stpi_data.txt', 'a')
24
- file_object.write(str(t_1_MaxValue))
25
  file_object.write(';')
26
  file_object.write(str(t_2_MaxValue))
27
  file_object.write(';')
28
- file_object.write(str(t_4_MaxValue))
29
  file_object.write(';')
30
  # file_object.write(str(Acc_0_5__1_0_MaxValue))
31
  # file_object.write(';')
32
- file_object.write(str(Abs_Diff_t_1_MaxValue))
33
  file_object.write(';')
34
  file_object.write(str(Abs_Diff_t_2_MaxValue))
35
  file_object.write(';')
36
- file_object.write(str(Abs_Diff_t_4_MaxValue))
37
  file_object.write(';')
38
  file_object.write('\n')
39
  file_object.close()
40
 
41
  result_3way = model.predict([X])
42
- print('The patient is ', outcome_decoded[int(result_3way)], 'through the 3way method')
43
  # result = 'The 3-way classification resulted in a ', outcome_decoded[int(result_3way)] + ' patient.'
44
  # further_analysis = 'Futher analysis using the 2-way classification resulted in a ' + outcome_decoded[int(result_2way)] + ' label.'
45
  return 'The patient is ' + outcome_decoded[int(result_3way)] + '.'
 
2
  import gradio as gr
3
  import joblib
4
  import dill
5
+ # import pickle
6
  import imblearn
7
  import sklearn
8
  import xgboost
 
10
  model = joblib.load(file_name)
11
 
12
 
13
+ def STPI(t_4_MaxValue,t_2_MaxValue,t_1_MaxValue,
14
  # Acc_0_5__1_0_MaxValue,
15
+ Abs_Diff_t_4_MaxValue,Abs_Diff_t_2_MaxValue,Abs_Diff_t_1_MaxValue):
16
  print('------------------')
17
 
18
+ X = [t_4_MaxValue,t_2_MaxValue,t_1_MaxValue,
19
  # Acc_0_5__1_0_MaxValue,
20
+ Abs_Diff_t_4_MaxValue,Abs_Diff_t_2_MaxValue,Abs_Diff_t_1_MaxValue]
21
  print(X)
22
+ outcome_decoded = ['Normal','','Suspect','Keratoconic']
23
  file_object = open('stpi_data.txt', 'a')
24
+ file_object.write(str(t_4_MaxValue))
25
  file_object.write(';')
26
  file_object.write(str(t_2_MaxValue))
27
  file_object.write(';')
28
+ file_object.write(str(t_1_MaxValue))
29
  file_object.write(';')
30
  # file_object.write(str(Acc_0_5__1_0_MaxValue))
31
  # file_object.write(';')
32
+ file_object.write(str(Abs_Diff_t_4_MaxValue))
33
  file_object.write(';')
34
  file_object.write(str(Abs_Diff_t_2_MaxValue))
35
  file_object.write(';')
36
+ file_object.write(str(Abs_Diff_t_1_MaxValue))
37
  file_object.write(';')
38
  file_object.write('\n')
39
  file_object.close()
40
 
41
  result_3way = model.predict([X])
42
+ # print('The patient is ', outcome_decoded[int(result_3way)], 'through the 3way method')
43
  # result = 'The 3-way classification resulted in a ', outcome_decoded[int(result_3way)] + ' patient.'
44
  # further_analysis = 'Futher analysis using the 2-way classification resulted in a ' + outcome_decoded[int(result_2way)] + ' label.'
45
  return 'The patient is ' + outcome_decoded[int(result_3way)] + '.'