awacke1 commited on
Commit
fd62e11
1 Parent(s): 693209f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
app.py CHANGED
@@ -156,20 +156,25 @@ def display_glossary_grid(roleplaying_glossary):
156
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
157
  st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
158
 
159
-
160
-
161
-
162
- # Streamlined UI for displaying buttons with scores, integrating emojis
163
  def display_buttons_with_scores():
164
- for header, terms in roleplaying_glossary.items():
165
- st.markdown(f"## {header}")
166
- for term in terms:
167
- key = generate_key(term, header, terms.index(term))
168
- score = load_score(key)
169
- if st.button(f"{term} {score}🚀", key=key):
170
- update_score(key)
171
- search_glossary('Create a three level markdown outline with 3 subpoints each where each line defines and writes out the core technology descriptions with appropriate emojis for the glossary term: ' + term)
172
- st.experimental_rerun()
 
 
 
 
 
 
 
 
 
173
 
174
  def fetch_wikipedia_summary(keyword):
175
  # Placeholder function for fetching Wikipedia summaries
 
156
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
157
  st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
158
 
 
 
 
 
159
  def display_buttons_with_scores():
160
+ # Assuming generate_key, load_score, update_score, and search_glossary are defined elsewhere
161
+ for category, games in roleplaying_glossary.items():
162
+ st.markdown(f"## {category}")
163
+ for game, terms in games.items():
164
+ for term in terms:
165
+ # Construct a unique key for each term. This replaces the previous use of .index()
166
+ # The key now includes both the category and the game for uniqueness
167
+ key = f"{category}_{game}_{term}".replace(' ', '_').lower()
168
+ score = load_score(key) # Load the score based on the generated key
169
+
170
+ # Display a button for each term with its score
171
+ if st.button(f"{term} {score}🚀", key=key):
172
+ # If button is pressed, update score and possibly rerun the search or action
173
+ update_score(key)
174
+ # Adjust the search_glossary call as needed to match the function's signature
175
+ search_glossary('Create a three-level markdown outline with 3 subpoints each where each line defines and writes out the descriptions with appropriate emojis for the glossary term: ' + term, roleplaying_glossary)
176
+ st.experimental_rerun()
177
+
178
 
179
  def fetch_wikipedia_summary(keyword):
180
  # Placeholder function for fetching Wikipedia summaries