Skip to content

Commit

Permalink
Linted code
Browse files Browse the repository at this point in the history
  • Loading branch information
andreped committed Jun 21, 2024
1 parent 5ad5add commit 8291c90
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions demo/src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ def process(self, mesh_file_name):
path = mesh_file_name.name
curr = path.split("/")[-1]
self.extension = ".".join(curr.split(".")[1:])
self.filename = curr.split(".")[0] + "-" + self.class_names[self.class_name]
self.filename = (
curr.split(".")[0] + "-" + self.class_names[self.class_name]
)
run_model(
path,
model_path=os.path.join(self.cwd, "resources/models/"),
task=self.class_names[self.class_name],
name=self.result_names[self.class_name],
output_filename=self.filename + "." + self.extension
output_filename=self.filename + "." + self.extension,
)
LOGGER.info("Converting prediction NIfTI to OBJ...")
nifti_to_obj(path=self.filename + "." + self.extension)
Expand All @@ -93,13 +95,17 @@ def process(self, mesh_file_name):
self.images = load_ct_to_numpy(path)

LOGGER.info("Loading prediction volume to numpy..")
self.pred_images = load_pred_volume_to_numpy(self.filename + "." + self.extension)
self.pred_images = load_pred_volume_to_numpy(
self.filename + "." + self.extension
)

return "./prediction.obj"

def download_prediction(self):
if (not self.filename) or (not self.extension):
LOGGER.error("The prediction is not available or ready to download. Wait until the result is available in the 3D viewer.")
LOGGER.error(
"The prediction is not available or ready to download. Wait until the result is available in the 3D viewer."
)
return self.filename + "." + self.extension

def get_img_pred_pair(self, k):
Expand Down Expand Up @@ -156,7 +162,9 @@ def run(self):
btn_clear_logs.click(flush_logs, [], [])

file_output = gr.File(
file_count="single", elem_id="upload", scale=3,
file_count="single",
elem_id="upload",
scale=3,
)
file_output.upload(
self.upload_file, file_output, file_output
Expand Down Expand Up @@ -225,8 +233,8 @@ def run(self):
visible=True,
elem_id="model-2d",
color_map={self.class_name: "#ffae00"},
#height=512,
#width=512,
# height=512,
# width=512,
)
self.slider.input(
self.get_img_pred_pair,
Expand All @@ -236,7 +244,7 @@ def run(self):

self.slider.render()

with gr.Group(): #gr.Box():
with gr.Group(): # gr.Box():
self.volume_renderer.render()

# sharing app publicly -> share=True:
Expand Down

0 comments on commit 8291c90

Please sign in to comment.