awacke1 commited on
Commit
8be87a8
β€’
1 Parent(s): 4a43aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -95,8 +95,37 @@ def display_glossary(area):
95
  st.write(f"{idx}. {term}")
96
 
97
 
98
- # Function to display glossary in a 3x3 grid
99
  def display_glossary_grid(glossary):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  # Group related categories for a 3x3 grid
101
  groupings = [
102
  ["πŸš€ Core Technologies", "🌐 Nations", "πŸ’‘ Memes"],
 
95
  st.write(f"{idx}. {term}")
96
 
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 = [
109
+ ["πŸš€ Core Technologies", "🌐 Nations", "πŸ’‘ Memes"],
110
+ ["πŸ› Institutions", "πŸ”— Organizations", "βš”οΈ War"],
111
+ ["πŸŽ– Military", "🦹 Outlaws", "πŸ‘½ Terrorists"],
112
+ ]
113
+
114
+ for group in groupings:
115
+ cols = st.columns(3) # Create columns for a 3x3 grid
116
+ for idx, category in enumerate(group):
117
+ with cols[idx]:
118
+ st.write(f"### {category}")
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
+
126
+
127
+ # Function to display glossary in a 3x3 grid
128
+ def display_glossary_grid_old(glossary):
129
  # Group related categories for a 3x3 grid
130
  groupings = [
131
  ["πŸš€ Core Technologies", "🌐 Nations", "πŸ’‘ Memes"],