Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,9 +88,6 @@ def preprocess_mri(nifti_path):
|
|
| 88 |
def predict_brain_age(nifti_file, actual_age):
|
| 89 |
return f"Brain Age estimate: 42"
|
| 90 |
|
| 91 |
-
def predict_brain_age_wrapper(nifti_file: gr.File, actual_age: float) -> tuple[str, str]:
|
| 92 |
-
return predict_brain_age(nifti_file, actual_age)
|
| 93 |
-
|
| 94 |
"""
|
| 95 |
def predict_brain_age(nifti_file, actual_age): #sex
|
| 96 |
if not os.path.exists(nifti_file.name):
|
|
@@ -186,6 +183,16 @@ else:
|
|
| 186 |
download_model()
|
| 187 |
|
| 188 |
# 🔹 Run Gradio App
|
| 189 |
-
if __name__ == "__main__":
|
| 190 |
-
demo.launch(share=True)
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
def predict_brain_age(nifti_file, actual_age):
|
| 89 |
return f"Brain Age estimate: 42"
|
| 90 |
|
|
|
|
|
|
|
|
|
|
| 91 |
"""
|
| 92 |
def predict_brain_age(nifti_file, actual_age): #sex
|
| 93 |
if not os.path.exists(nifti_file.name):
|
|
|
|
| 183 |
download_model()
|
| 184 |
|
| 185 |
# 🔹 Run Gradio App
|
| 186 |
+
#if __name__ == "__main__":
|
| 187 |
+
# demo.launch(share=True)
|
| 188 |
|
| 189 |
+
iface = gr.Interface(
|
| 190 |
+
fn=predict_brain_age, # decorated with @spaces.GPU
|
| 191 |
+
inputs=[gr.File(label="Upload T1w MRI"), gr.Number(label="Enter Age")],
|
| 192 |
+
outputs=[gr.Textbox(label="Predicted Brain Age"), gr.Textbox(label="Brain Age Difference")],
|
| 193 |
+
title="🧠 BrainAgeNeXt",
|
| 194 |
+
description="Upload a T1w MRI and enter the subject's age to predict brain age."
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
if __name__ == "__main__":
|
| 198 |
+
iface.launch(share=True)
|