Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -95,8 +95,37 @@ def display_glossary(area):
|
|
95 |
st.write(f"{idx}. {term}")
|
96 |
|
97 |
|
98 |
-
|
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"],
|