Skip to content
Snippets Groups Projects
Commit efad3875 authored by ofhkr's avatar ofhkr Committed by fima
Browse files

Command Line Interface for qim3d

parent 7a26f1ca
No related branches found
No related tags found
1 merge request!40Command Line Interface for qim3d
......@@ -353,7 +353,10 @@ class Operations:
] + 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__":
# Creates interface
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface)
run_interface()
\ No newline at end of file
......@@ -629,8 +629,11 @@ class Pipeline:
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__":
# Creates interface
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface)
run_interface()
\ No newline at end of file
......@@ -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__":
# Creates interface
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface)
run_interface()
\ No newline at end of file
......@@ -421,8 +421,10 @@ class Pipeline:
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__":
# Creates interface
gradio_interface = Interface().create_interface()
internal_tools.run_gradio_app(gradio_interface)
run_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():
return port_dict
def run_gradio_app(gradio_interface):
host = "0.0.0.0"
def run_gradio_app(gradio_interface, host = "0.0.0.0"):
# Get port using the QIM API
port_dict = get_port_dict()
......@@ -291,7 +291,7 @@ def run_gradio_app(gradio_interface):
print(f"http://{host}:{port}{path}")
# 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():
......
......@@ -18,6 +18,11 @@ setup(
url="https://lab.compute.dtu.dk/QIM/tools/qim3d",
packages=find_packages(),
include_package_data=True,
entry_points = {
'console_scripts': [
'qim3d=qim3d.utils.cli:main'
]
},
classifiers=[
"License :: OSI Approved :: MIT License",
"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