Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions erniekit/webui/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,7 @@ def update_language(language):
if col_config["options"]
else None
),
allow_custom_value=True,
)
elif col_config["type"] == "textbox":
col = gr.Textbox(scale=col_config.get("scale", 1), value="")
Expand Down
2 changes: 1 addition & 1 deletion erniekit/webui/view/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def build(manager):
default_system_prompt = config.get_default_user_dict("chat", "system_prompt")
default_thought_checkbox = config.get_default_user_dict("chat", "thought_checkbox")

with gr.Tab() as chat_tab:
with gr.Tab("chat_tab") as chat_tab:
chat_info = gr.HTML()

with gr.Row():
Expand Down
2 changes: 1 addition & 1 deletion erniekit/webui/view/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def build(manager):
)
default_eval_logging_dir = config.get_default_user_dict("eval", "logging_dir")

with gr.Tab() as eval_tab:
with gr.Tab("eval_tab") as eval_tab:
with gr.Row():
eval_dataset_path = gr.Textbox(
value=default_eval_dataset_path,
Expand Down
2 changes: 1 addition & 1 deletion erniekit/webui/view/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build(manager):

default_max_shard_size = config.get_default_user_dict("export", "max_shard_size")

with gr.Tab() as export_tab:
with gr.Tab("export_tab") as export_tab:
with gr.Row():
max_shard_size = gr.Slider(
minimum=1,
Expand Down
2 changes: 1 addition & 1 deletion erniekit/webui/view/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def build(manager):
)
default_train_text_dataset = config.get_default_user_dict("train", "text_dataset")

with gr.Tab() as train_tab:
with gr.Tab("train_tab") as train_tab:
with gr.Row():
best_config = gr.Dropdown(
choices=config.get_choices_kwargs("best_config"),
Expand Down
28 changes: 26 additions & 2 deletions erniekit/webui/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
The startup interface of ErnieKit WebUI
"""

import os
import resource
import sys
from pathlib import Path
Expand All @@ -36,6 +37,21 @@
logging.getLogger("httpx").setLevel(logging.WARNING)


def is_env_enabled(env_name: str) -> bool:
"""Check if environment variables are enabled"""
return os.getenv(env_name, "").lower() in ["true", "1", "yes"]


def fix_proxy(ipv6_enabled: bool = False) -> None:
"""Fix Gradio UI proxy settings to prevent local connections from being disrupted by proxies"""
os.environ["no_proxy"] = "localhost,127.0.0.1,0.0.0.0"
if ipv6_enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么ipv6需要去掉这些proxy设置

os.environ.pop("http_proxy", None)
os.environ.pop("HTTP_PROXY", None)
os.environ.pop("https_proxy", None)
os.environ.pop("HTTPS_PROXY", None)


def create_ui():
with gr.Blocks(title="ErnieKit WebUI", theme=gr.themes.Ocean()) as demo:
gr.HTML(f"<style>{CSS}</style>")
Expand All @@ -55,14 +71,22 @@ def create_ui():
manager.setup_language_switching(language, demo, alert)

manager.setup_component_tracking(demo)

return demo


def run_webui():
# Read environment variable configuration
gradio_ipv6 = is_env_enabled("GRADIO_IPV6")
gradio_share = is_env_enabled("GRADIO_SHARE")
server_name = os.getenv("GRADIO_SERVER_NAME", "[::]" if gradio_ipv6 else "0.0.0.0")

# Fix proxy settings to avoid network interference
fix_proxy(ipv6_enabled=gradio_ipv6)

print("Starting ErnieKit WebUI")

demo = create_ui()
demo.queue().launch(server_name="0.0.0.0", share=False)
demo.queue().launch(server_name=server_name, share=gradio_share, inbrowser=True)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions requirements/gpu/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ decord
moviepy
GPUtil
openai
gradio
gradio==5.42.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前最新版本是多少?是否可以限制一个版本范围?

opencv-python==4.5.5.64
imgaug==0.4.0
triton==3.3
use-triton-in-paddle
tensorboardX
ujson
einops
einops