awacke1 commited on
Commit
97416f8
โ€ข
1 Parent(s): 8be87a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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.replace(' ', '_')}",
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