From 459cc1162a10df361e51660dc31c524d5042965e Mon Sep 17 00:00:00 2001 From: stark-eth <1319114370@qq.com> Date: Thu, 30 Mar 2023 15:13:57 +0800 Subject: [PATCH] feat: support colab web ui --- web.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web.py b/web.py index 7b08346..ef7aad4 100644 --- a/web.py +++ b/web.py @@ -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() \ No newline at end of file