SebastianBravo commited on
Commit
81e2ca1
1 Parent(s): d1ac89f
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -30,13 +30,18 @@ if not os.path.exists("mlp_probabilidad.h5"):
30
  # Scaler para scores
31
  if not os.path.exists("scaler.pickle"):
32
  urlretrieve("https://dl.dropboxusercontent.com/s/ow6pe4k45r3xkbl/scaler.pickle?dl=0", "scaler.pickle")
 
 
 
 
 
33
 
34
  path_3d_unet = 'unet.h5'
35
  weight_path = 'resnet_50_23dataset.pth'
36
  svm_path = "svm_model.pickle"
37
  prob_model_path = "mlp_probabilidad.h5"
38
  scaler_path = "scaler.pickle"
39
-
40
 
41
  '''---------------------------- Carga de modelos ------------------------------'''
42
  # 3D U-Net
@@ -103,7 +108,7 @@ def save_file(input_name, input_age, input_phone_num, input_emer_name, input_eme
103
  input_medications, input_allergies,diagnosis):
104
 
105
 
106
- with open('results.txt', 'w') as f:
107
  # Save Patient Data
108
  f.write("Patient data:\n")
109
  f.write(f"\tName: {input_name.capitalize()}\n")
@@ -181,7 +186,7 @@ def get_diagnosis(brain_img, input_name, input_age, input_phone_num, input_emer_
181
  input_Respiratory_rate, input_Body_temperature, input_Pluse_oximetry,
182
  input_medications, input_allergies,diagnosis)
183
 
184
- return gr.update(value=diagnosis), gr.update(value="results.txt", visible=True), gr.update(visible=True)
185
 
186
 
187
  def clear():
@@ -210,7 +215,7 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
210
  input_phone_num = gr.Number(label='Phone number')
211
  input_emer_name = gr.Textbox(placeholder='Enter the emergency contact name', label='Emergency contact name')
212
  input_emer_phone_num = gr.Number(label='Emergency contact name phone number', value=None)
213
- input_sex = gr.Dropdown(["Male", "Female"], label="Sex")
214
 
215
  with gr.Tab("Clinical data"):
216
  input_MMSE = gr.Slider(minimum=0,
@@ -294,11 +299,11 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
294
 
295
  ## Authors
296
 
297
- - Daniel Stiven Zambrano Acosta <span>B.Sc</span>
298
- - Juan Sebasti谩n Bravo Santacruz <span>B.Sc</span>
299
- - Wilson Javier Arenas L贸pez <span>M.Sc</span>
300
- - Pablo Alexander Reyes Gavilan PhD
301
- - Miguel Alfonso Altuve PhD
302
 
303
 
304
  ## Acknowledgement
 
30
  # Scaler para scores
31
  if not os.path.exists("scaler.pickle"):
32
  urlretrieve("https://dl.dropboxusercontent.com/s/ow6pe4k45r3xkbl/scaler.pickle?dl=0", "scaler.pickle")
33
+
34
+ # Archivo de texto para reportes
35
+ if not os.path.exists("report.txt"):
36
+ urlretrieve("https://dl.dropboxusercontent.com/s/ycjpkd65rhlicxq/report.txt?dl=0", "report.txt")
37
+
38
 
39
  path_3d_unet = 'unet.h5'
40
  weight_path = 'resnet_50_23dataset.pth'
41
  svm_path = "svm_model.pickle"
42
  prob_model_path = "mlp_probabilidad.h5"
43
  scaler_path = "scaler.pickle"
44
+ report_path = "report.txt"
45
 
46
  '''---------------------------- Carga de modelos ------------------------------'''
47
  # 3D U-Net
 
108
  input_medications, input_allergies,diagnosis):
109
 
110
 
111
+ with open(report_path, 'w') as f:
112
  # Save Patient Data
113
  f.write("Patient data:\n")
114
  f.write(f"\tName: {input_name.capitalize()}\n")
 
186
  input_Respiratory_rate, input_Body_temperature, input_Pluse_oximetry,
187
  input_medications, input_allergies,diagnosis)
188
 
189
+ return gr.update(value=diagnosis), gr.update(value=report_path, visible=True), gr.update(visible=True)
190
 
191
 
192
  def clear():
 
215
  input_phone_num = gr.Number(label='Phone number')
216
  input_emer_name = gr.Textbox(placeholder='Enter the emergency contact name', label='Emergency contact name')
217
  input_emer_phone_num = gr.Number(label='Emergency contact name phone number', value=None)
218
+ input_sex = gr.Dropdown(["Male", "Female"], label="Sex", value="Male")
219
 
220
  with gr.Tab("Clinical data"):
221
  input_MMSE = gr.Slider(minimum=0,
 
299
 
300
  ## Authors
301
 
302
+ - Daniel Stiven Zambrano Acosta, <span>B.Sc</span>
303
+ - Juan Sebasti谩n Bravo Santacruz, <span>B.Sc</span>
304
+ - Ing. Wilson Javier Arenas L贸pez, <span>M.Sc</span>
305
+ - Psy. Pablo Alexander Reyes Gavilan, PhD
306
+ - Ing. Miguel Alfonso Altuve, PhD
307
 
308
 
309
  ## Acknowledgement