Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -20,19 +20,18 @@ def pdf_to_word(pdf_file):
|
|
20 |
def word_to_pdf(docx_file):
|
21 |
pdf_filename = "output.pdf"
|
22 |
|
23 |
-
doc = Document(docx_file)
|
24 |
pdf = FPDF(format='A4')
|
25 |
pdf.set_auto_page_break(auto=True, margin=15)
|
26 |
pdf.add_page()
|
27 |
pdf.add_font('Arial', '', 'Arial.ttf', uni=True)
|
28 |
pdf.set_font('Arial', size=12)
|
29 |
|
30 |
-
|
31 |
for para in doc.paragraphs:
|
32 |
text = para.text.strip()
|
33 |
-
if not text:
|
34 |
continue
|
35 |
-
|
36 |
words = text.split()
|
37 |
line = ''
|
38 |
for word in words:
|
@@ -47,7 +46,7 @@ def word_to_pdf(docx_file):
|
|
47 |
pdf.output(pdf_filename)
|
48 |
return pdf_filename
|
49 |
|
50 |
-
with gr.Blocks() as app:
|
51 |
gr.Markdown(title_and_description)
|
52 |
|
53 |
with gr.Row():
|
|
|
20 |
def word_to_pdf(docx_file):
|
21 |
pdf_filename = "output.pdf"
|
22 |
|
23 |
+
doc = Document(docx_file.name)
|
24 |
pdf = FPDF(format='A4')
|
25 |
pdf.set_auto_page_break(auto=True, margin=15)
|
26 |
pdf.add_page()
|
27 |
pdf.add_font('Arial', '', 'Arial.ttf', uni=True)
|
28 |
pdf.set_font('Arial', size=12)
|
29 |
|
|
|
30 |
for para in doc.paragraphs:
|
31 |
text = para.text.strip()
|
32 |
+
if not text:
|
33 |
continue
|
34 |
+
|
35 |
words = text.split()
|
36 |
line = ''
|
37 |
for word in words:
|
|
|
46 |
pdf.output(pdf_filename)
|
47 |
return pdf_filename
|
48 |
|
49 |
+
with gr.Blocks(theme="xiaobaiyuan/theme_brief") as app:
|
50 |
gr.Markdown(title_and_description)
|
51 |
|
52 |
with gr.Row():
|