diff --git a/README.md b/README.md index fdcd8166..5818efc0 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,8 @@ Furthermore, GraphGen incorporates multi-hop neighborhood sampling to capture co ### Gradio Demo -1. Enter `webui` directory ```bash - cd webui - ``` -2. Run the Gradio demo - ```bash - gradio app.py + gradio webui/app.py ``` ![ui](resources/images/interface.jpg) diff --git a/requirements.txt b/requirements.txt index ab003249..ab329cb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ nltk jieba plotly pandas -gradio +gradio>=5.25.0 gradio-i18n==0.3.0 kaleido pyyaml diff --git a/webui/app.py b/webui/app.py index fc227716..6c9aa498 100644 --- a/webui/app.py +++ b/webui/app.py @@ -170,11 +170,10 @@ def run_graphgen(*arguments: list, progress=gr.Progress()): except Exception as e: # pylint: disable=broad-except raise gr.Error(f"Error occurred: {str(e)}") - with gr.Blocks(title="GraphGen Demo", theme=gr.themes.Glass(), css=css) as demo: # Header - gr.Image(value=f"{root_dir}/resources/images/logo.png", + gr.Image(value=os.path.join(root_dir, 'resources', 'images', 'logo.png'), label="GraphGen Banner", elem_id="banner", interactive=False, @@ -210,7 +209,7 @@ def run_graphgen(*arguments: list, progress=gr.Progress()): """) with Translate( - "translation.json", + os.path.join(root_dir, 'webui', 'translation.json'), lang_btn, placeholder_langs=["en", "zh"], persistant= @@ -328,10 +327,11 @@ def run_graphgen(*arguments: list, progress=gr.Progress()): file_types=[".txt", ".json", ".jsonl"], interactive=True, ) + examples_dir = os.path.join(root_dir, 'webui', 'examples') gr.Examples(examples=[ - [f"{root_dir}/webui/examples/txt_demo.txt"], - [f"{root_dir}/webui/examples/raw_demo.jsonl"], - [f"{root_dir}/webui/examples/chunked_demo.json"], + [os.path.join(examples_dir, "txt_demo.txt")], + [os.path.join(examples_dir, "raw_demo.jsonl")], + [os.path.join(examples_dir, "chunked_demo.json")], ], inputs=upload_file, label="Example Files", diff --git a/webui/translation.json b/webui/translation.json index c9a9a340..8c4c7b84 100644 --- a/webui/translation.json +++ b/webui/translation.json @@ -2,7 +2,7 @@ "en": { "Title": "✨Easy-to-use LLM Training Data Generation Framework✨", "Intro": "is a framework for synthetic data generation guided by knowledge graphs, designed to tackle challenges for knowledge-intensive QA generation. \n\nBy uploading your text chunks (such as knowledge in agriculture, healthcare, or marine science) and filling in the LLM API key, you can generate the training data required by **LLaMA-Factory** and **xtuner** online. We will automatically delete user information after completion.", - "Use Trainee Model": "Use Trainee Model to identify knowledge blind spots, disable by default", + "Use Trainee Model": "Use Trainee Model to identify knowledge blind spots, please keep disable for SiliconCloud", "Base URL Info": "Base URL for the API, use SiliconFlow as default", "Synthesizer Model Info": "Model for constructing KGs and generating QAs", "Trainee Model Info": "Model for training", @@ -12,7 +12,7 @@ "zh": { "Title": "✨开箱即用的LLM训练数据生成框架✨", "Intro": "是一个基于知识图谱的合成数据生成框架,旨在解决知识密集型问答生成的挑战。\n\n 上传你的文本块(如农业、医疗、海洋知识),填写 LLM api key,即可在线生成 **LLaMA-Factory**、**xtuner** 所需训练数据。结束后我们将自动删除用户信息。", - "Use Trainee Model": "使用Trainee Model来识别知识盲区,默认禁用", + "Use Trainee Model": "使用Trainee Model来识别知识盲区,使用硅基流动时请保持禁用", "Base URL Info": "调用模型API的URL,默认使用硅基流动", "Synthesizer Model Info": "用于构建知识图谱和生成问答的模型", "Trainee Model Info": "用于训练的模型",