fix colab runtime

pull/860/head
stark-eth 2023-03-30 15:18:52 +08:00
parent 459cc1162a
commit 1397010773
2 changed files with 4 additions and 6 deletions

View File

@ -18,6 +18,7 @@ from control.mkgui.base import Opyrator
from control.mkgui.base.core import name_to_title
from . import schema_utils
from .streamlit_utils import CUSTOM_STREAMLIT_CSS
from pyngrok import ngrok
STREAMLIT_RUNNER_SNIPPET = """
from control.mkgui.base.ui import render_streamlit_ui
@ -59,7 +60,10 @@ def launch_ui(port: int = 8501) -> None:
f"""{python_path} "{sys.executable}" -m streamlit run --server.port={port} --server.headless=True --runner.magicEnabled=False --server.maxUploadSize=50 --browser.gatherUsageStats=False {f.name}""",
shell=True,
)
# Setup a tunnel to the streamlit port 2023
public_url = ngrok.connect(port="2023")
print(public_url)
f.close()
unlink(f.name)

6
web.py
View File

@ -1,7 +1,6 @@
import os
import sys
import typer
from pyngrok import ngrok
cli = typer.Typer()
@ -19,11 +18,6 @@ def launch(port: int = typer.Option(2023, "--port", "-p")) -> None:
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__":