使用 gradio 自带复制到剪贴板功能

This commit is contained in:
William Jin 2024-09-22 22:27:56 +08:00
parent 6cdabb5005
commit acd7853986
2 changed files with 6 additions and 13 deletions

View File

@ -2,8 +2,6 @@ import gradio as gr
import subprocess
import os
import re
import clipman
clipman.init()
def convert_to_wav(audio_file):
@ -204,18 +202,14 @@ with gr.Blocks() as iface:
with gr.Tab("下载pdf"):
gr.Markdown("## pdf 下载指令修复")
with gr.Row():
with gr.Column():
power_shell_text_input = gr.Textbox(lines=15, placeholder="请在此输入power shell 脚本...")
with gr.Column():
power_shell_pdf_button = gr.Button("转换")
power_shell_pdf_copy_button = gr.Button("复制")
status_text = gr.Textbox(label="Status")
with gr.Column():
power_shell_text_output = gr.Textbox(lines=15, placeholder="这里会显示结果")
power_shell_text_input = gr.Textbox(lines=10, placeholder="请在此输入power shell 脚本...")
with gr.Row():
power_shell_pdf_button = gr.Button("转换")
with gr.Row():
power_shell_text_output = gr.Textbox(lines=10, placeholder="这里会显示结果", show_copy_button=True)
power_shell_pdf_button.click(power_shell_pdf_download, inputs=power_shell_text_input,
outputs=power_shell_text_output)
power_shell_pdf_copy_button.click(fn=copy_text, inputs=power_shell_text_output, outputs=status_text)
iface.load(fn=update_log_output, outputs=[log_output], every=1)

View File

@ -1,2 +1 @@
gradio==4.44.0
clipman~=3.3.1