Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,10 +17,8 @@ bnb_config = BitsAndBytesConfig(load_in_8bit=True)
|
|
17 |
def convert_to_markdown(input_text):
|
18 |
"""Converts bird information text to Markdown format,
|
19 |
making specific keywords bold and adding headings.
|
20 |
-
|
21 |
Args:
|
22 |
input_text (str): The input text containing bird information.
|
23 |
-
|
24 |
Returns:
|
25 |
str: The formatted Markdown text.
|
26 |
"""
|
@@ -31,11 +29,11 @@ def convert_to_markdown(input_text):
|
|
31 |
title, content = map(str.strip, input_text.split(":", 1))
|
32 |
# Bold the keywords
|
33 |
for word in bold_words:
|
34 |
-
content = content.replace(word, f'\n**{word}
|
35 |
-
content = content.replace(f'** ', f' ')
|
36 |
|
37 |
# Construct the Markdown output with headings
|
38 |
-
formatted_output = f"**{title}{content}"
|
39 |
|
40 |
|
41 |
return formatted_output.strip()
|
|
|
17 |
def convert_to_markdown(input_text):
|
18 |
"""Converts bird information text to Markdown format,
|
19 |
making specific keywords bold and adding headings.
|
|
|
20 |
Args:
|
21 |
input_text (str): The input text containing bird information.
|
|
|
22 |
Returns:
|
23 |
str: The formatted Markdown text.
|
24 |
"""
|
|
|
29 |
title, content = map(str.strip, input_text.split(":", 1))
|
30 |
# Bold the keywords
|
31 |
for word in bold_words:
|
32 |
+
content = content.replace(word, f'\n\n**{word}\n')
|
33 |
+
# content = content.replace(f'** ', f' ')
|
34 |
|
35 |
# Construct the Markdown output with headings
|
36 |
+
formatted_output = f"**{title}**{content}"
|
37 |
|
38 |
|
39 |
return formatted_output.strip()
|