Merge pull request #6170 from hykilpikonna/main

[+] Show the hostname in webui title

Former-commit-id: 263cb82bdb3dfb0c213018f25022686a3dab617e
This commit is contained in:
hoshi-hiyouga 2024-12-04 18:07:29 +08:00 committed by GitHub
commit ed4c4bab49

View File

@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import os import os
import platform
from ..extras.packages import is_gradio_available from ..extras.packages import is_gradio_available
from .common import save_config from .common import save_config
@ -34,8 +35,9 @@ if is_gradio_available():
def create_ui(demo_mode: bool = False) -> "gr.Blocks": def create_ui(demo_mode: bool = False) -> "gr.Blocks":
engine = Engine(demo_mode=demo_mode, pure_chat=False) engine = Engine(demo_mode=demo_mode, pure_chat=False)
hostname = os.getenv("HOSTNAME", os.getenv("COMPUTERNAME", platform.node())).split('.')[0]
with gr.Blocks(title="LLaMA Board", css=CSS) as demo: with gr.Blocks(title=f"LLaMA Board ({hostname})", css=CSS) as demo:
if demo_mode: if demo_mode:
gr.HTML("<h1><center>LLaMA Board: A One-stop Web UI for Getting Started with LLaMA Factory</center></h1>") gr.HTML("<h1><center>LLaMA Board: A One-stop Web UI for Getting Started with LLaMA Factory</center></h1>")
gr.HTML( gr.HTML(