enable inbrowser in webui

This commit is contained in:
hiyouga 2024-05-17 00:08:56 +08:00
parent d77bed4091
commit 694a05fd04
2 changed files with 3 additions and 3 deletions

View File

@ -73,10 +73,10 @@ def create_web_demo() -> gr.Blocks:
def run_web_ui() -> None: def run_web_ui() -> None:
gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"] gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"]
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0") server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
create_ui().queue().launch(share=gradio_share, server_name=server_name) create_ui().queue().launch(share=gradio_share, server_name=server_name, inbrowser=True)
def run_web_demo() -> None: def run_web_demo() -> None:
gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"] gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"]
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0") server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
create_web_demo().queue().launch(share=gradio_share, server_name=server_name) create_web_demo().queue().launch(share=gradio_share, server_name=server_name, inbrowser=True)

View File

@ -6,7 +6,7 @@ from llamafactory.webui.interface import create_ui
def main(): def main():
gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"] gradio_share = os.environ.get("GRADIO_SHARE", "0").lower() in ["true", "1"]
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0") server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
create_ui().queue().launch(share=gradio_share, server_name=server_name) create_ui().queue().launch(share=gradio_share, server_name=server_name, inbrowser=True)
if __name__ == "__main__": if __name__ == "__main__":