FrancescoLR commited on
Commit
d31c850
·
verified ·
1 Parent(s): fdebb93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -85,8 +85,8 @@ def preprocess_mri(nifti_path):
85
 
86
  # 🔹 Run Brain Age Prediction (Decorated for GPU Execution)
87
  @spaces.GPU(duration=90)
88
- def predict_brain_age(age, sex): #, actual_age):
89
- return f"Brain Age estimate: 42", sex
90
 
91
  """
92
  def predict_brain_age(nifti_file, actual_age): #sex
@@ -143,6 +143,8 @@ with gr.Blocks() as demo:
143
  with gr.Row():
144
  with gr.Column(scale=1):
145
  #mri_input = gr.File(label="Upload a T1w MRI (NIfTI .nii.gz)")
 
 
146
  age_input = gr.Number(label="Enter Age", value=50)
147
  sex_input = gr.Radio(["Male", "Female"], label="Select Sex")
148
  submit_button = gr.Button("Predict")
@@ -155,7 +157,7 @@ with gr.Blocks() as demo:
155
 
156
  submit_button.click(
157
  fn=predict_brain_age,
158
- inputs=[age_input, sex_input], # mri_input, sex_input
159
  outputs=[brain_age_output, bad_output]
160
  )
161
 
 
85
 
86
  # 🔹 Run Brain Age Prediction (Decorated for GPU Execution)
87
  @spaces.GPU(duration=90)
88
+ def predict_brain_age(path, age, sex): #, actual_age):
89
+ return f"Brain Age estimate: 42", age
90
 
91
  """
92
  def predict_brain_age(nifti_file, actual_age): #sex
 
143
  with gr.Row():
144
  with gr.Column(scale=1):
145
  #mri_input = gr.File(label="Upload a T1w MRI (NIfTI .nii.gz)")
146
+ mri_input = gr.File(label="Upload a T1w MRI", type="filepath", file_types=[".nii.gz"])
147
+
148
  age_input = gr.Number(label="Enter Age", value=50)
149
  sex_input = gr.Radio(["Male", "Female"], label="Select Sex")
150
  submit_button = gr.Button("Predict")
 
157
 
158
  submit_button.click(
159
  fn=predict_brain_age,
160
+ inputs=[path, age_input, sex_input], # mri_input, sex_input
161
  outputs=[brain_age_output, bad_output]
162
  )
163