From 9da3cdb614d956e1550d9171b859894be16777d8 Mon Sep 17 00:00:00 2001 From: William Jin Date: Mon, 6 Oct 2025 10:31:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0gradio=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chyoso_toolkit_ui.py | 6 ++++-- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chyoso_toolkit_ui.py b/chyoso_toolkit_ui.py index ac3ccc3..6f4578b 100644 --- a/chyoso_toolkit_ui.py +++ b/chyoso_toolkit_ui.py @@ -290,7 +290,7 @@ with gr.Blocks() as iface: list_file_button = gr.Button("刷新文件") batch_process_button = gr.Button("批量处理") with gr.Column(): - batch_output_file = gr.File(label="批量转写结果") + batch_output_file = gr.Files(label="批量转写结果") with gr.Row(): log_output = gr.Textbox(label="日志信息", lines=10) @@ -350,6 +350,8 @@ with gr.Blocks() as iface: # 绑定按钮点击事件 process_button.click(batch_ocr, inputs=[input_files, user_query_text], outputs=output_file) - iface.load(fn=update_log_output, outputs=[log_output], every=1) + # 使用 Gradio 5 的定时器 API 周期性更新日志输出 + timer = gr.Timer(1.0) + timer.tick(fn=update_log_output, outputs=[log_output]) iface.launch(server_name="0.0.0.0") diff --git a/requirements.txt b/requirements.txt index 467c942..8a54e03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -gradio==4.44.0 +gradio==5.49.0 openai==1.44.1 python-dotenv~=1.0.1 pillow~=10.4.0 \ No newline at end of file