Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,19 +25,21 @@ def convert_to_markdown(input_text):
|
|
25 |
str: The formatted Markdown text.
|
26 |
"""
|
27 |
|
28 |
-
bold_words = ['Look:', 'Cool Fact!:', 'Habitat:', 'Food:', 'Birdie Behaviors:']
|
29 |
|
30 |
-
# Split into title and content based on the first ":", handling extra whitespace
|
31 |
-
title, content = map(str.strip, input_text.split(":", 1))
|
32 |
-
# Bold the keywords
|
33 |
-
for word in bold_words:
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
# Construct the Markdown output with headings
|
38 |
-
formatted_output = f"**{title}{content}"
|
|
|
39 |
|
40 |
-
|
|
|
41 |
|
42 |
@spaces.GPU
|
43 |
def infer_fin_pali(image, question):
|
|
|
25 |
str: The formatted Markdown text.
|
26 |
"""
|
27 |
|
28 |
+
# bold_words = ['Look:', 'Cool Fact!:', 'Habitat:', 'Food:', 'Birdie Behaviors:']
|
29 |
|
30 |
+
# # Split into title and content based on the first ":", handling extra whitespace
|
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}**\n')
|
35 |
+
# content = content.replace(f'** ', f' ')
|
36 |
|
37 |
+
# # Construct the Markdown output with headings
|
38 |
+
# formatted_output = f"**{title}{content}"
|
39 |
+
input_text = """**ABBOTT'S BABBLER (Malacocincla abbotti)** \n **Look:** \n Robin-sized detective! This bird has a sandy-brown body with rusty flanks, a short tail, and a heavy hooked bill. Check for a pale gray eyebrow in Southeast Asia. \n **Cool Fact!:** \n Works in pairs, hopping on the forest floor like little detectives searching for clues (their prey!). \n **Habitat:** \n Prefers the shady undergrowth of permanent forests, especially near streams and tangled vegetation. \n **Food:** \n Not picky eaters! They enjoy a varied menu of insects, worms, and even seeds. \n **Birdie Behaviors:** \n Secretive by nature, but listen for their surprising calls – a mix of harsh churrs and melodic whistles."""
|
40 |
|
41 |
+
|
42 |
+
return input_text
|
43 |
|
44 |
@spaces.GPU
|
45 |
def infer_fin_pali(image, question):
|