QINGCHE commited on
Commit
ae028f0
2 Parent(s): 9fd45d8 b5b3cdf

Merge branch

Browse files
Files changed (1) hide show
  1. app.py +48 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import numpy as np
2
  import gradio as gr
3
  import textInput
@@ -43,4 +44,51 @@ with gr.Blocks(css = ".output {min-height: 500px}") as demo:
43
  text_button.click(textInput.text_dump_to_lines, inputs=[text_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
44
  file_button.click(textInput.file_dump_to_lines,inputs=[file_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  demo.launch(show_api=False, enable_queue=False)
 
1
+ <<<<<<< HEAD
2
  import numpy as np
3
  import gradio as gr
4
  import textInput
 
44
  text_button.click(textInput.text_dump_to_lines, inputs=[text_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
45
  file_button.click(textInput.file_dump_to_lines,inputs=[file_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
46
 
47
+ =======
48
+ import numpy as np
49
+ import gradio as gr
50
+ import textInput
51
+ from BERT_inference import BertClassificationModel
52
+
53
+
54
+ output = []
55
+ keys = []
56
+
57
+ # css = ".output {min-height: 500px}"
58
+
59
+
60
+ with gr.Blocks(css = ".output {min-height: 500px}") as demo:
61
+ #用markdown语法编辑输出一段话
62
+ gr.Markdown("# 文本分类系统")
63
+ gr.Markdown("请选择要输入的文件或填入文本")
64
+ topic_num = gr.Number(label="主题个数")
65
+ max_length = gr.Number(label="摘要最大长度")
66
+ with gr.Tabs():
67
+ with gr.Tab("文本输入"):
68
+ text_input = gr.TextArea(lines=10)
69
+ text_button = gr.Button("生成")
70
+
71
+ with gr.Tab("文件输入"):
72
+ gr.Markdown("目前支持的格式有PDF、Word、txt")
73
+ file_input = gr.File(file_types=["text", ".pdf", ".docx"])
74
+ file_button = gr.Button("生成")
75
+ # 设置tab选项卡
76
+ with gr.Tabs():
77
+ with gr.Tab("分类页"):
78
+ text_keys_output = gr.TextArea(lines=30)
79
+
80
+ with gr.Tab("摘要页",):
81
+ #Blocks特有组件,设置所有子组件按水平排列
82
+ text_ab_output = gr.TextArea(lines=30)
83
+
84
+ with gr.Tab("下载页"):
85
+ file_txt_output = gr.File(label="txt格式")
86
+ file_docx_output = gr.File(label="docx格式")
87
+ file_pdf_output = gr.File(label="pdf格式")
88
+ # with gr.Accordion("Open for More!"):
89
+ # gr.Markdown("Look at me...")
90
+ text_button.click(textInput.text_dump_to_lines, inputs=[text_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
91
+ file_button.click(textInput.file_dump_to_lines,inputs=[file_input,topic_num,max_length], outputs=[text_keys_output,text_ab_output,file_txt_output,file_docx_output,file_pdf_output])
92
+
93
+ >>>>>>> caa3d6bb9666e5411846d44a3538cf2d565abfb9
94
  demo.launch(show_api=False, enable_queue=False)