Spaces:
Runtime error
Runtime error
Update utils/braille_display.py
Browse files- utils/braille_display.py +5 -1
utils/braille_display.py
CHANGED
@@ -37,16 +37,20 @@ def create_braille_html(braille_text):
|
|
37 |
# Convert to Unicode Braille if not already
|
38 |
unicode_braille = text_to_unicode_braille(braille_text)
|
39 |
|
|
|
|
|
|
|
40 |
# Create HTML with proper styling
|
41 |
html = f"""
|
42 |
<div style="font-family: 'Courier New', monospace; font-size: 20px; line-height: 1.5;
|
43 |
background-color: #f5f5f5; padding: 15px; border-radius: 5px;">
|
44 |
-
{
|
45 |
</div>
|
46 |
"""
|
47 |
|
48 |
return html
|
49 |
|
|
|
50 |
def create_braille_comparison(text, braille_text):
|
51 |
"""
|
52 |
Create a side-by-side comparison of text and its Braille representation.
|
|
|
37 |
# Convert to Unicode Braille if not already
|
38 |
unicode_braille = text_to_unicode_braille(braille_text)
|
39 |
|
40 |
+
# Replace newlines with <br> tags before using in f-string
|
41 |
+
formatted_text = unicode_braille.replace('\n', '<br>')
|
42 |
+
|
43 |
# Create HTML with proper styling
|
44 |
html = f"""
|
45 |
<div style="font-family: 'Courier New', monospace; font-size: 20px; line-height: 1.5;
|
46 |
background-color: #f5f5f5; padding: 15px; border-radius: 5px;">
|
47 |
+
{formatted_text}
|
48 |
</div>
|
49 |
"""
|
50 |
|
51 |
return html
|
52 |
|
53 |
+
|
54 |
def create_braille_comparison(text, braille_text):
|
55 |
"""
|
56 |
Create a side-by-side comparison of text and its Braille representation.
|