Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,22 @@ from models.text_processor import process_menu_text
|
|
11 |
from models.braille_translator import text_to_braille, get_braille_metadata
|
12 |
from utils.pdf_generator import create_braille_pdf, create_braille_pdf_with_comparison
|
13 |
|
14 |
-
|
15 |
def generate_pdf(original_text, braille_text, title, comparison=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
"""Generate a PDF file with Braille content."""
|
17 |
if comparison:
|
18 |
pdf_buffer = create_braille_pdf_with_comparison(original_text, braille_text, title)
|
|
|
11 |
from models.braille_translator import text_to_braille, get_braille_metadata
|
12 |
from utils.pdf_generator import create_braille_pdf, create_braille_pdf_with_comparison
|
13 |
|
14 |
+
|
15 |
def generate_pdf(original_text, braille_text, title, comparison=False):
|
16 |
+
"""Generate a PDF file with Braille content."""
|
17 |
+
try:
|
18 |
+
if comparison:
|
19 |
+
pdf_buffer = create_braille_pdf_with_comparison(original_text, braille_text, title)
|
20 |
+
else:
|
21 |
+
pdf_buffer = create_braille_pdf(original_text, braille_text, title)
|
22 |
+
|
23 |
+
return pdf_buffer
|
24 |
+
except Exception as e:
|
25 |
+
print(f"Error in generate_pdf: {str(e)}")
|
26 |
+
raise
|
27 |
+
|
28 |
+
# Function to create a download link for a PDF
|
29 |
+
def generate_pdf1(original_text, braille_text, title, comparison=False):
|
30 |
"""Generate a PDF file with Braille content."""
|
31 |
if comparison:
|
32 |
pdf_buffer = create_braille_pdf_with_comparison(original_text, braille_text, title)
|