Spaces:
Sleeping
Sleeping
Demo improvements
Browse files- demo/src/gui.py +4 -4
- demo/src/utils.py +2 -2
demo/src/gui.py
CHANGED
@@ -11,7 +11,7 @@ class WebUI:
|
|
11 |
self.pred_images = []
|
12 |
|
13 |
# @TODO: This should be dynamically set based on chosen volume size
|
14 |
-
self.nb_slider_items =
|
15 |
|
16 |
self.class_name = class_name
|
17 |
self.cwd = cwd
|
@@ -34,9 +34,9 @@ class WebUI:
|
|
34 |
def load_mesh(self, mesh_file_name):
|
35 |
path = mesh_file_name.name
|
36 |
run_model(path)
|
37 |
-
nifti_to_glb("prediction
|
38 |
self.images = load_ct_to_numpy(path)
|
39 |
-
self.pred_images = load_pred_volume_to_numpy("./prediction
|
40 |
self.slider = self.slider.update(value=2)
|
41 |
return "./prediction.obj"
|
42 |
|
@@ -74,7 +74,7 @@ class WebUI:
|
|
74 |
|
75 |
with gr.Row():
|
76 |
gr.Examples(
|
77 |
-
examples=[self.cwd + "
|
78 |
inputs=file_output,
|
79 |
outputs=file_output,
|
80 |
fn=self.upload_file,
|
|
|
11 |
self.pred_images = []
|
12 |
|
13 |
# @TODO: This should be dynamically set based on chosen volume size
|
14 |
+
self.nb_slider_items = 160
|
15 |
|
16 |
self.class_name = class_name
|
17 |
self.cwd = cwd
|
|
|
34 |
def load_mesh(self, mesh_file_name):
|
35 |
path = mesh_file_name.name
|
36 |
run_model(path)
|
37 |
+
nifti_to_glb("./prediction.nii.gz")
|
38 |
self.images = load_ct_to_numpy(path)
|
39 |
+
self.pred_images = load_pred_volume_to_numpy("./prediction.nii.gz")
|
40 |
self.slider = self.slider.update(value=2)
|
41 |
return "./prediction.obj"
|
42 |
|
|
|
74 |
|
75 |
with gr.Row():
|
76 |
gr.Examples(
|
77 |
+
examples=[self.cwd + "lung_001.nii.gz"],
|
78 |
inputs=file_output,
|
79 |
outputs=file_output,
|
80 |
fn=self.upload_file,
|
demo/src/utils.py
CHANGED
@@ -11,8 +11,8 @@ def load_ct_to_numpy(data_path):
|
|
11 |
|
12 |
data = np.rot90(data, k=1, axes=(0, 1))
|
13 |
|
14 |
-
data[data < -
|
15 |
-
data[data >
|
16 |
|
17 |
data = data - np.amin(data)
|
18 |
data = data / np.amax(data) * 255
|
|
|
11 |
|
12 |
data = np.rot90(data, k=1, axes=(0, 1))
|
13 |
|
14 |
+
data[data < -1024] = 1024
|
15 |
+
data[data > 1024] = 1024
|
16 |
|
17 |
data = data - np.amin(data)
|
18 |
data = data / np.amax(data) * 255
|