From 145ecf379d0c812a08150e7fa6f93ab5350fe017 Mon Sep 17 00:00:00 2001 From: VincentXiuyuanZhao Date: Fri, 31 May 2024 19:03:05 +0800 Subject: [PATCH] add check for xml tags and Eng words --- testAny.py | 2 +- testGrDownload.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/testAny.py b/testAny.py index 453daf1..96d0714 100644 --- a/testAny.py +++ b/testAny.py @@ -83,7 +83,7 @@ def check_df_english(defaultDf=pd.DataFrame(data)): return df if __name__ == '__main__': - df = pd.read_excel('test_response0529_160times.xlsx') + df = pd.read_excel('tmpc_l9sci0.xlsx') checked_df = check_df_tags(df) checked_df = check_df_english(checked_df) # 保存结果到Excel文件 diff --git a/testGrDownload.py b/testGrDownload.py index 9c6b4eb..c1d57de 100644 --- a/testGrDownload.py +++ b/testGrDownload.py @@ -6,7 +6,7 @@ from http import HTTPStatus import dashscope from dashscope import Generation import os - +from testAny import check_df_english, check_df_tags dashscope.api_key = os.getenv("DASHSCOPE_API_KEY") # Vincent's API key @@ -84,6 +84,8 @@ def main(): output_file = gr.File(label="下载处理后的文件") clear_data = gr.ClearButton(components=[output_table, output_file], value="Clear processed data") clear_all = gr.ClearButton(components=[file_input, output_table, output_file], value="Clear console") + check_tags_button = gr.Button("检查xlsx文件-tags") + check_english_button = gr.Button("检查xlsx文件-英文") def update_output(xlsx_file, instruction): if xlsx_file is not None: formatted_df, tmp_path = process_xlsx(xlsx_file, instruction) @@ -91,6 +93,7 @@ def main(): submit_button.click(fn=update_output, inputs=[file_input, system_instruction], outputs=[output_table, output_file]) + check_tags_button.click(fn=check_df_tags, inputs=[output_table], outputs=[output_table]) demo.launch()