Skip to content
Snippets Groups Projects
Commit 2e94eb52 authored by fima's avatar fima :beers:
Browse files

Merge branch 'Qim3d_CLI' into 'main'

Command Line Interface for qim3d

See merge request !40
parents 7a26f1ca efad3875
Branches
Tags
1 merge request!40Command Line Interface for qim3d
...@@ -353,7 +353,10 @@ class Operations: ...@@ -353,7 +353,10 @@ class Operations:
] + output_masks_update ] + output_masks_update
def run_interface(host = "0.0.0.0"):
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface,host)
if __name__ == "__main__": if __name__ == "__main__":
# Creates interface # Creates interface
gradio_interface = Interface().create_interface() run_interface()
internal_tools.run_gradio_app(gradio_interface) \ No newline at end of file
...@@ -629,8 +629,11 @@ class Pipeline: ...@@ -629,8 +629,11 @@ class Pipeline:
return vol_hist, bin_edges return vol_hist, bin_edges
def run_interface(host = "0.0.0.0"):
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface,host)
if __name__ == "__main__": if __name__ == "__main__":
# Creates interface # Creates interface
gradio_interface = Interface().create_interface() run_interface()
internal_tools.run_gradio_app(gradio_interface) \ No newline at end of file
...@@ -397,7 +397,11 @@ class Interface: ...@@ -397,7 +397,11 @@ class Interface:
) )
def run_interface(host = "0.0.0.0"):
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface,host)
if __name__ == "__main__": if __name__ == "__main__":
# Creates interface # Creates interface
gradio_interface = Interface().create_interface() run_interface()
internal_tools.run_gradio_app(gradio_interface) \ No newline at end of file
...@@ -421,8 +421,10 @@ class Pipeline: ...@@ -421,8 +421,10 @@ class Pipeline:
return filename return filename
def run_interface(host = "0.0.0.0"):
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface,host)
if __name__ == "__main__": if __name__ == "__main__":
# Creates interface # Creates interface
gradio_interface = Interface().create_interface() run_interface()
internal_tools.run_gradio_app(gradio_interface) \ No newline at end of file
import argparse
from qim3d.gui import data_explorer, iso3d, annotation_tool, local_thickness
def main():
parser = argparse.ArgumentParser(description='Qim3d command-line interface.')
subparsers = parser.add_subparsers(title='Subcommands', dest='subcommand')
# subcommands
gui_parser = subparsers.add_parser('gui', help = 'Graphical User Interfaces.')
gui_parser.add_argument('--data-explorer', action='store_true', help='Run data explorer.')
gui_parser.add_argument('--iso3d', action='store_true', help='Run iso3d.')
gui_parser.add_argument('--annotation-tool', action='store_true', help='Run annotation tool.')
gui_parser.add_argument('--local-thickness', action='store_true', help='Run local thickness tool.')
gui_parser.add_argument('--host', default='0.0.0.0', help='Desired host.')
args = parser.parse_args()
if args.subcommand == 'gui':
arghost = args.host
if args.data_explorer:
data_explorer.run_interface(arghost)
elif args.iso3d:
iso3d.run_interface(arghost)
elif args.annotation_tool:
annotation_tool.run_interface(arghost)
elif args.local_thickness:
local_thickness.run_interface(arghost)
if __name__ == '__main__':
main()
\ No newline at end of file
...@@ -267,8 +267,8 @@ def get_port_dict(): ...@@ -267,8 +267,8 @@ def get_port_dict():
return port_dict return port_dict
def run_gradio_app(gradio_interface): def run_gradio_app(gradio_interface, host = "0.0.0.0"):
host = "0.0.0.0"
# Get port using the QIM API # Get port using the QIM API
port_dict = get_port_dict() port_dict = get_port_dict()
...@@ -291,7 +291,7 @@ def run_gradio_app(gradio_interface): ...@@ -291,7 +291,7 @@ def run_gradio_app(gradio_interface):
print(f"http://{host}:{port}{path}") print(f"http://{host}:{port}{path}")
# Run the FastAPI server usign uvicorn # Run the FastAPI server usign uvicorn
run(app, host="0.0.0.0", port=int(port)) run(app, host=host, port=int(port))
def get_css(): def get_css():
......
...@@ -18,6 +18,11 @@ setup( ...@@ -18,6 +18,11 @@ setup(
url="https://lab.compute.dtu.dk/QIM/tools/qim3d", url="https://lab.compute.dtu.dk/QIM/tools/qim3d",
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
entry_points = {
'console_scripts': [
'qim3d=qim3d.utils.cli:main'
]
},
classifiers=[ classifiers=[
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment