fix gradio args

This commit is contained in:
hiyouga 2024-05-06 23:33:06 +08:00
parent c8cd00bec6
commit a153039380
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,5 @@
import os
from ..extras.packages import is_gradio_available
from .common import save_config
from .components import (
@ -69,8 +71,14 @@ def create_web_demo() -> gr.Blocks:
def run_web_ui() -> None:
create_ui().queue().launch()
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
server_port = int(os.environ.get("GRADIO_SERVER_PORT", "7860"))
gradio_share = bool(int(os.environ.get("GRADIO_SHARE", "0")))
create_ui().queue().launch(share=gradio_share, server_name=server_name, server_port=server_port)
def run_web_demo() -> None:
create_web_demo().queue().launch()
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
server_port = int(os.environ.get("GRADIO_SERVER_PORT", "7860"))
gradio_share = bool(int(os.environ.get("GRADIO_SHARE", "0")))
create_web_demo().queue().launch(share=gradio_share, server_name=server_name, server_port=server_port)

View File

@ -1,8 +1,13 @@
import os
from llmtuner.webui.interface import create_ui
def main():
create_ui().queue().launch(server_name="0.0.0.0", server_port=None, share=False)
server_name = os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0")
server_port = int(os.environ.get("GRADIO_SERVER_PORT", "7860"))
gradio_share = bool(int(os.environ.get("GRADIO_SHARE", "0")))
create_ui().queue().launch(share=gradio_share, server_name=server_name, server_port=server_port)
if __name__ == "__main__":