Skip to content

Commit bd5b3d2

Browse files
Merge pull request #3 from open-sciencelab/gradio-add-args
feat(webui/app.py): use translate.json in relative path
2 parents c05963d + bf11f74 commit bd5b3d2

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@ Furthermore, GraphGen incorporates multi-hop neighborhood sampling to capture co
3636

3737
### Gradio Demo
3838

39-
1. Enter `webui` directory
4039
```bash
41-
cd webui
42-
```
43-
2. Run the Gradio demo
44-
```bash
45-
gradio app.py
40+
gradio webui/app.py
4641
```
4742

4843
![ui](resources/images/interface.jpg)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ nltk
1212
jieba
1313
plotly
1414
pandas
15-
gradio
15+
gradio>=5.25.0
1616
gradio-i18n==0.3.0
1717
kaleido
1818
pyyaml

webui/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@ def run_graphgen(*arguments: list, progress=gr.Progress()):
170170
except Exception as e: # pylint: disable=broad-except
171171
raise gr.Error(f"Error occurred: {str(e)}")
172172

173-
174173
with gr.Blocks(title="GraphGen Demo", theme=gr.themes.Glass(),
175174
css=css) as demo:
176175
# Header
177-
gr.Image(value=f"{root_dir}/resources/images/logo.png",
176+
gr.Image(value=os.path.join(root_dir, 'resources', 'images', 'logo.png'),
178177
label="GraphGen Banner",
179178
elem_id="banner",
180179
interactive=False,
@@ -210,7 +209,7 @@ def run_graphgen(*arguments: list, progress=gr.Progress()):
210209
</div>
211210
""")
212211
with Translate(
213-
"translation.json",
212+
os.path.join(root_dir, 'webui', 'translation.json'),
214213
lang_btn,
215214
placeholder_langs=["en", "zh"],
216215
persistant=
@@ -328,10 +327,11 @@ def run_graphgen(*arguments: list, progress=gr.Progress()):
328327
file_types=[".txt", ".json", ".jsonl"],
329328
interactive=True,
330329
)
330+
examples_dir = os.path.join(root_dir, 'webui', 'examples')
331331
gr.Examples(examples=[
332-
[f"{root_dir}/webui/examples/txt_demo.txt"],
333-
[f"{root_dir}/webui/examples/raw_demo.jsonl"],
334-
[f"{root_dir}/webui/examples/chunked_demo.json"],
332+
[os.path.join(examples_dir, "txt_demo.txt")],
333+
[os.path.join(examples_dir, "raw_demo.jsonl")],
334+
[os.path.join(examples_dir, "chunked_demo.json")],
335335
],
336336
inputs=upload_file,
337337
label="Example Files",

webui/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"en": {
33
"Title": "✨Easy-to-use LLM Training Data Generation Framework✨",
44
"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.",
5-
"Use Trainee Model": "Use Trainee Model to identify knowledge blind spots, disable by default",
5+
"Use Trainee Model": "Use Trainee Model to identify knowledge blind spots, please keep disable for SiliconCloud",
66
"Base URL Info": "Base URL for the API, use SiliconFlow as default",
77
"Synthesizer Model Info": "Model for constructing KGs and generating QAs",
88
"Trainee Model Info": "Model for training",
@@ -12,7 +12,7 @@
1212
"zh": {
1313
"Title": "✨开箱即用的LLM训练数据生成框架✨",
1414
"Intro": "是一个基于知识图谱的合成数据生成框架,旨在解决知识密集型问答生成的挑战。\n\n 上传你的文本块(如农业、医疗、海洋知识),填写 LLM api key,即可在线生成 **LLaMA-Factory**、**xtuner** 所需训练数据。结束后我们将自动删除用户信息。",
15-
"Use Trainee Model": "使用Trainee Model来识别知识盲区,默认禁用",
15+
"Use Trainee Model": "使用Trainee Model来识别知识盲区,使用硅基流动时请保持禁用",
1616
"Base URL Info": "调用模型API的URL,默认使用硅基流动",
1717
"Synthesizer Model Info": "用于构建知识图谱和生成问答的模型",
1818
"Trainee Model Info": "用于训练的模型",

0 commit comments

Comments
 (0)