2022-05-09 18:44:02 +08:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import typer
|
2021-09-21 16:56:12 +08:00
|
|
|
|
2022-05-09 18:44:02 +08:00
|
|
|
cli = typer.Typer()
|
|
|
|
|
|
|
|
@cli.command()
|
2022-08-12 23:13:57 +08:00
|
|
|
def launch(port: int = typer.Option(8080, "--port", "-p")) -> None:
|
2022-05-09 18:44:02 +08:00
|
|
|
"""Start a graphical UI server for the opyrator.
|
|
|
|
|
|
|
|
The UI is auto-generated from the input- and output-schema of the given function.
|
|
|
|
"""
|
|
|
|
# Add the current working directory to the sys path
|
|
|
|
# This is required to resolve the opyrator path
|
|
|
|
sys.path.append(os.getcwd())
|
|
|
|
|
2022-12-03 16:54:06 +08:00
|
|
|
from control.mkgui.base.ui.streamlit_ui import launch_ui
|
2022-05-09 18:44:02 +08:00
|
|
|
launch_ui(port)
|
2021-09-21 16:56:12 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-05-09 18:44:02 +08:00
|
|
|
cli()
|