diff --git a/qim3d/gui/annotation_tool.py b/qim3d/gui/annotation_tool.py index c3c60c1dc1dfe23d68c0e16c31e692859446967c..230ad9cb74186a6d954e16dfd45635d60f1c67ad 100644 --- a/qim3d/gui/annotation_tool.py +++ b/qim3d/gui/annotation_tool.py @@ -170,7 +170,9 @@ class Interface: fn=operations.save_mask, inputs=output_masks, outputs=[save_output, save_output], - ) + ).success( + fn=lambda: os.remove('mask.tif') + ) # Remove mask file from working directory immediately after sending it to /tmp/gradio # Update 'Add mask' button interactivit according to the current count counts.change( diff --git a/qim3d/gui/iso3d.py b/qim3d/gui/iso3d.py index 1536aa7d4854ac463326295f396c914ac72b137e..d59e6f1852cfe9683253f209369cfbcf16430783 100644 --- a/qim3d/gui/iso3d.py +++ b/qim3d/gui/iso3d.py @@ -186,6 +186,11 @@ class Interface: self.save_fig(fig, "iso3d.html") return fig, "iso3d.html" + + def remove_unused_file(self): + # Remove localthickness.tif file from working directory + # as it otherwise is not deleted + os.remove("iso3d.html") def create_interface(self): # Create gradio app @@ -367,6 +372,7 @@ class Interface: # fmt: off btn_run.click( fn=self.process, inputs=inputs, outputs=outputs).success( + fn=self.remove_unused_file).success( fn=self.make_visible, inputs=None, outputs=plot_download) # fmt: on diff --git a/qim3d/gui/local_thickness.py b/qim3d/gui/local_thickness.py index b3a7dce18fb44beb6a2e7c543295bcdc822f760d..ae4b625b942d4b0318f57129a1e4ba4f535b347e 100644 --- a/qim3d/gui/local_thickness.py +++ b/qim3d/gui/local_thickness.py @@ -90,7 +90,6 @@ class Interface: quiet=quiet, height=self.height, width=self.width, - show_tips=False, ) return @@ -272,6 +271,7 @@ class Interface: fn=pipeline.output_viz, inputs=session, outputs=output_vol).success( fn=pipeline.thickness_histogram, inputs=session, outputs=histogram).success( fn=pipeline.save_lt, inputs=session, outputs=lt_output).success( + fn=pipeline.remove_unused_file).success( fn=self.make_visible, inputs=None, outputs=lt_output) @@ -420,6 +420,11 @@ class Pipeline: tifffile.imwrite(filename, session.vol_thickness) return filename + + def remove_unused_file(self): + # Remove localthickness.tif file from working directory + # as it otherwise is not deleted + os.remove('localthickness.tif') def run_interface(host = "0.0.0.0"): gradio_interface = Interface().create_interface()