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())
|
|
|
|
|
|
|
|
from mkgui.base.ui.streamlit_ui import launch_ui
|
|
|
|
launch_ui(port)
|
2021-09-21 16:56:12 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-05-09 18:44:02 +08:00
|
|
|
cli()
|