changxin commited on
Commit
7d0031a
·
1 Parent(s): b085183

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,11 +1,12 @@
1
  import gradio as gr
2
  import docx
 
3
 
4
  from docx import Document
5
  def wd(x):
6
  doc=Document(x)
7
  all_paragraphs = document.paragraphs
8
- t=[y.text for paragraph in all_paragraphs]
9
  return t
10
 
11
  demo=gr.Blocks(css="#jsc:hover{background-color: red;}")
@@ -13,7 +14,7 @@ with demo:
13
  with gr.Tabs():
14
  with gr.TabItem("读取word"):
15
  file_input = gr.File(file_count="single",label="请选择需要读取的word文件",show_label=True)
16
- text_output = gr.Textbox(label="输出读取文本",show_label=True)
17
  dq_button = gr.Button("开始读取>>")
18
  dq_button.click(wd, inputs=file_input, outputs=text_output,api_name="word-text")
19
 
 
1
  import gradio as gr
2
  import docx
3
+ import pandas
4
 
5
  from docx import Document
6
  def wd(x):
7
  doc=Document(x)
8
  all_paragraphs = document.paragraphs
9
+ t=pd.DataFrame([y.text for paragraph in all_paragraphs])
10
  return t
11
 
12
  demo=gr.Blocks(css="#jsc:hover{background-color: red;}")
 
14
  with gr.Tabs():
15
  with gr.TabItem("读取word"):
16
  file_input = gr.File(file_count="single",label="请选择需要读取的word文件",show_label=True)
17
+ text_output = gr.gr.DataFrame(label="输出读取文本",show_label=True)
18
  dq_button = gr.Button("开始读取>>")
19
  dq_button.click(wd, inputs=file_input, outputs=text_output,api_name="word-text")
20