Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,12 +97,12 @@ def display_glossary(area):
|
|
97 |
|
98 |
|
99 |
def display_glossary_grid(glossary):
|
100 |
-
# Search URL functions with emoji as keys
|
101 |
search_urls = {
|
102 |
-
"๐": lambda k: f"https://en.wikipedia.org/wiki/{k
|
103 |
-
"๐": lambda k: f"https://www.google.com/search?q={k}",
|
104 |
-
"โถ๏ธ": lambda k: f"https://www.youtube.com/results?search_query={k}",
|
105 |
-
"๐": lambda k: f"https://www.bing.com/search?q={k}"
|
106 |
}
|
107 |
|
108 |
groupings = [
|
@@ -119,7 +119,7 @@ def display_glossary_grid(glossary):
|
|
119 |
if category in glossary:
|
120 |
terms = glossary[category]
|
121 |
for term in terms:
|
122 |
-
# Generate and display links for each term
|
123 |
links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
|
124 |
st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
|
125 |
|
|
|
97 |
|
98 |
|
99 |
def display_glossary_grid(glossary):
|
100 |
+
# Search URL functions with emoji as keys, now using quote for URL safety
|
101 |
search_urls = {
|
102 |
+
"๐": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
|
103 |
+
"๐": lambda k: f"https://www.google.com/search?q={quote(k)}",
|
104 |
+
"โถ๏ธ": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
105 |
+
"๐": lambda k: f"https://www.bing.com/search?q={quote(k)}"
|
106 |
}
|
107 |
|
108 |
groupings = [
|
|
|
119 |
if category in glossary:
|
120 |
terms = glossary[category]
|
121 |
for term in terms:
|
122 |
+
# Generate and display links for each term, now safely encoding URLs
|
123 |
links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
|
124 |
st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
|
125 |
|