|
import numpy as np
|
|
import gradio as gr
|
|
import textInput
|
|
|
|
output = []
|
|
keys = []
|
|
|
|
|
|
with gr.Blocks() as demo:
|
|
|
|
gr.Markdown("# 文本分类系统")
|
|
gr.Markdown("请选择要输入的文件或填入文本")
|
|
topic_num = gr.Textbox("主题数")
|
|
max_length = gr.Textbox("摘要最大长度")
|
|
with gr.Tabs():
|
|
with gr.Tab("文本输入"):
|
|
text_input = gr.Textbox()
|
|
text_button = gr.Button("生成")
|
|
|
|
with gr.Tab("文件输入"):
|
|
gr.Markdown("目前支持的格式有PDF、Word、txt")
|
|
file_input = gr.File()
|
|
|
|
with gr.Tabs():
|
|
with gr.Tab("分类页"):
|
|
text_keys_output = gr.Textbox()
|
|
|
|
with gr.Tab("摘要页"):
|
|
|
|
text_ab_output = gr.Textbox()
|
|
|
|
|
|
text_button.click(textInput.text_dump_to_json, inputs=[text_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output])
|
|
|
|
demo.launch() |