QINGCHE commited on
Commit
76769bb
1 Parent(s): ae028f0
Files changed (1) hide show
  1. app.py +1 -49
app.py CHANGED
@@ -1,50 +1,3 @@
1
- <<<<<<< HEAD
2
- import numpy as np
3
- import gradio as gr
4
- import textInput
5
- from BERT_inference import BertClassificationModel
6
-
7
-
8
- output = []
9
- keys = []
10
-
11
- # css = ".output {min-height: 500px}"
12
-
13
-
14
- with gr.Blocks(css = ".output {min-height: 500px}") as demo:
15
- #用markdown语法编辑输出一段话
16
- gr.Markdown("# 文本分类系统")
17
- gr.Markdown("请选择要输入的文件或填入文本")
18
- topic_num = gr.Number(label="主题个数")
19
- max_length = gr.Number(label="摘要最大长度")
20
- with gr.Tabs():
21
- with gr.Tab("文本输入"):
22
- text_input = gr.TextArea(lines=10)
23
- text_button = gr.Button("生成")
24
-
25
- with gr.Tab("文件输入"):
26
- gr.Markdown("目前支持的格式有PDF、Word、txt")
27
- file_input = gr.File(file_types=["text", ".pdf", ".docx"])
28
- file_button = gr.Button("生成")
29
- # 设置tab选项卡
30
- with gr.Tabs():
31
- with gr.Tab("分类页"):
32
- text_keys_output = gr.TextArea(lines=30)
33
-
34
- with gr.Tab("摘要页",):
35
- #Blocks特有组件,设置所有子组件按水平排列
36
- text_ab_output = gr.TextArea(lines=30)
37
-
38
- with gr.Tab("下载页"):
39
- file_txt_output = gr.File(label="txt格式")
40
- file_docx_output = gr.File(label="docx格式")
41
- file_pdf_output = gr.File(label="pdf格式")
42
- # with gr.Accordion("Open for More!"):
43
- # gr.Markdown("Look at me...")
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
@@ -89,6 +42,5 @@ with gr.Blocks(css = ".output {min-height: 500px}") as demo:
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)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import numpy as np
2
  import gradio as gr
3
  import textInput
 
42
  # gr.Markdown("Look at me...")
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)