Spaces:
Running
Running
Yunhua Mo
commited on
Commit
•
35cd81d
1
Parent(s):
9feee7b
Update app.py
Browse files
app.py
CHANGED
@@ -10,21 +10,26 @@ def convert_pdf_to_word(pdf_file):
|
|
10 |
# Create a temporary file to store the converted Word document
|
11 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".docx") as tmp_file:
|
12 |
word_file = tmp_file.name
|
13 |
-
|
14 |
# Create converter object and perform conversion
|
15 |
cv = Converter(pdf_file.name)
|
16 |
cv.convert(word_file)
|
17 |
cv.close()
|
18 |
-
|
19 |
return word_file
|
20 |
|
21 |
# Create Gradio interface
|
22 |
iface = gr.Interface(
|
23 |
fn=convert_pdf_to_word,
|
24 |
-
inputs=gr.File(label="Upload PDF File", type="filepath"),
|
25 |
outputs=gr.File(label="Download Word File"),
|
26 |
title="PDF to Word Converter",
|
27 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
28 |
analytics_enabled=False
|
29 |
)
|
30 |
|
|
|
10 |
# Create a temporary file to store the converted Word document
|
11 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".docx") as tmp_file:
|
12 |
word_file = tmp_file.name
|
13 |
+
|
14 |
# Create converter object and perform conversion
|
15 |
cv = Converter(pdf_file.name)
|
16 |
cv.convert(word_file)
|
17 |
cv.close()
|
18 |
+
|
19 |
return word_file
|
20 |
|
21 |
# Create Gradio interface
|
22 |
iface = gr.Interface(
|
23 |
fn=convert_pdf_to_word,
|
24 |
+
inputs=gr.File(label="Upload PDF File", type="filepath",file_types=["pdf"]),
|
25 |
outputs=gr.File(label="Download Word File"),
|
26 |
title="PDF to Word Converter",
|
27 |
+
description="""
|
28 |
+
<p>Converting PDF to Word is a common office task, and this application allows you to convert PDF to Word documents with just one click.</p>
|
29 |
+
<p>Upload a PDF file and download the converted Word document.</p>
|
30 |
+
<p>For more PDF tools, visit: <a href="https://pdf-tools.wingetgui.com/" target="_blank">pdf-tools.wingetgui.com</a></p>
|
31 |
+
""",
|
32 |
+
allow_flagging="never",
|
33 |
analytics_enabled=False
|
34 |
)
|
35 |
|