feat: support colab web ui

This commit is contained in:
stark-eth 2023-03-30 15:13:57 +08:00
parent 4892b2e2d4
commit 459cc1162a

9
web.py
View File

@ -1,9 +1,11 @@
import os
import sys
import typer
from pyngrok import ngrok
cli = typer.Typer()
@cli.command()
def launch(port: int = typer.Option(2023, "--port", "-p")) -> None:
"""Start a graphical UI server for the opyrator.
@ -15,7 +17,14 @@ def launch(port: int = typer.Option(2023, "--port", "-p")) -> None:
sys.path.append(os.getcwd())
from control.mkgui.base.ui.streamlit_ui import launch_ui
launch_ui(port)
# Setup a tunnel to the streamlit port 2023
public_url = ngrok.connect(port="2023")
print(public_url)
if __name__ == "__main__":
cli()