Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import numpy as np
|
|
| 5 |
from pathlib import Path
|
| 6 |
from huggingface_hub import snapshot_download
|
| 7 |
from fastMONAI.vision_all import *
|
|
|
|
| 8 |
import sys
|
| 9 |
|
| 10 |
# Debug: List all symbols imported from fastMONAI.vision_all
|
|
@@ -134,22 +135,9 @@ save_dir.mkdir(parents=True, exist_ok=True)
|
|
| 134 |
|
| 135 |
|
| 136 |
# Debug: Check if load_system_resources is defined
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
else:
|
| 141 |
-
print("[DEBUG] 'load_system_resources' NOT found in current namespace.")
|
| 142 |
-
|
| 143 |
-
# Try to call load_system_resources and catch NameError
|
| 144 |
-
try:
|
| 145 |
-
# Load the model and other required resources
|
| 146 |
-
learn, reorder, resample = load_system_resources(models_path=models_path,
|
| 147 |
-
learner_fn='heart_model.pkl',
|
| 148 |
-
variables_fn='vars.pkl')
|
| 149 |
-
except NameError as e:
|
| 150 |
-
print("[ERROR] NameError:", e)
|
| 151 |
-
print("[ERROR] 'load_system_resources' is not defined. Please check your fastMONAI installation or provide the function definition.")
|
| 152 |
-
sys.exit(1)
|
| 153 |
|
| 154 |
# Gradio interface setup
|
| 155 |
output_text = gr.Textbox(label="Volume of the Left Atrium (mL):")
|
|
|
|
| 5 |
from pathlib import Path
|
| 6 |
from huggingface_hub import snapshot_download
|
| 7 |
from fastMONAI.vision_all import *
|
| 8 |
+
from fastMONAI.vision_inference import load_system_resources, inference, compute_binary_tumor_volume
|
| 9 |
import sys
|
| 10 |
|
| 11 |
# Debug: List all symbols imported from fastMONAI.vision_all
|
|
|
|
| 135 |
|
| 136 |
|
| 137 |
# Debug: Check if load_system_resources is defined
|
| 138 |
+
learn, reorder, resample = load_system_resources(models_path=models_path,
|
| 139 |
+
learner_fn='heart_model.pkl',
|
| 140 |
+
variables_fn='vars.pkl')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
# Gradio interface setup
|
| 143 |
output_text = gr.Textbox(label="Volume of the Left Atrium (mL):")
|