awacke1 commited on
Commit
31ef098
·
verified ·
1 Parent(s): e96e4c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -108
app.py CHANGED
@@ -14,8 +14,6 @@ import textract
14
  import time
15
  import zipfile
16
  import dotenv
17
- import DeitiesAndDemigods as DnD
18
-
19
  from gradio_client import Client
20
  from audio_recorder_streamlit import audio_recorder
21
  from bs4 import BeautifulSoup
@@ -31,7 +29,7 @@ from xml.etree import ElementTree as ET
31
  from PIL import Image
32
  from urllib.parse import quote # Ensure this import is included
33
 
34
- # 1. 🔧📝 - Configuration
35
  Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
36
  title="🔬🧠ScienceBrain.AI"
37
  helpURL='https://huggingface.co/awacke1'
@@ -50,11 +48,6 @@ st.set_page_config(
50
  )
51
 
52
 
53
- def load_file(file_name):
54
- with open(file_name, "r", encoding='utf-8') as file:
55
- content = file.read()
56
- return content
57
-
58
 
59
  # HTML5 based Speech Synthesis (Text to Speech in Browser)
60
  @st.cache_resource
@@ -89,46 +82,41 @@ def SpeechSynthesis(result):
89
  def parse_to_markdown(text):
90
  return text
91
 
92
-
93
-
94
-
95
- import re
 
96
 
97
  def extract_urls(text):
98
  try:
99
- # Regular expression patterns to find the required fields
100
  date_pattern = re.compile(r'### (\d{2} \w{3} \d{4})')
101
  abs_link_pattern = re.compile(r'\[(.*?)\]\((https://arxiv\.org/abs/\d+\.\d+)\)')
102
  pdf_link_pattern = re.compile(r'\[⬇️\]\((https://arxiv\.org/pdf/\d+\.\d+)\)')
103
  title_pattern = re.compile(r'### \d{2} \w{3} \d{4} \| \[(.*?)\]')
104
-
105
- # Find all occurrences of the required fields using the regular expression patterns
106
  date_matches = date_pattern.findall(text)
107
  abs_link_matches = abs_link_pattern.findall(text)
108
  pdf_link_matches = pdf_link_pattern.findall(text)
109
  title_matches = title_pattern.findall(text)
110
 
111
- # Generate markdown string with the extracted fields
112
  markdown_text = ""
113
  for i in range(len(date_matches)):
114
  date = date_matches[i]
115
  title = title_matches[i]
116
  abs_link = abs_link_matches[i][1]
117
  pdf_link = pdf_link_matches[i]
118
-
119
  markdown_text += f"**Date:** {date}\n\n"
120
  markdown_text += f"**Title:** {title}\n\n"
121
  markdown_text += f"**Abstract Link:** [{abs_link}]({abs_link})\n\n"
122
  markdown_text += f"**PDF Link:** [{pdf_link}]({pdf_link})\n\n"
123
  markdown_text += "---\n\n"
124
-
125
  return markdown_text
 
126
  except:
127
  st.write('.')
128
  return ''
129
 
130
-
131
-
132
  def download_pdfs(urls):
133
  local_files = []
134
  for url in urls:
@@ -152,9 +140,6 @@ def generate_html(local_files):
152
  def search_arxiv(query):
153
  start_time = time.strftime("%Y-%m-%d %H:%M:%S")
154
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
155
-
156
- # Search 1 - Retrieve the Papers
157
- client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
158
  response1 = client.predict(
159
  query,
160
  20,
@@ -164,8 +149,6 @@ def search_arxiv(query):
164
  )
165
  Question = '### 🔎 ' + query + '\r\n' # Format for markdown display with links
166
  References = response1[0]
167
-
168
- # URLs from the response
169
  ReferenceLinks = extract_urls(References)
170
 
171
  RunSecondQuery = True
@@ -186,8 +169,6 @@ def search_arxiv(query):
186
 
187
  st.write('🔍Run of Multi-Agent System Paper Summary Spec is Complete')
188
  end_time = time.strftime("%Y-%m-%d %H:%M:%S")
189
-
190
- # Output
191
  start_timestamp = time.mktime(time.strptime(start_time, "%Y-%m-%d %H:%M:%S"))
192
  end_timestamp = time.mktime(time.strptime(end_time, "%Y-%m-%d %H:%M:%S"))
193
  elapsed_seconds = end_timestamp - start_timestamp
@@ -221,62 +202,59 @@ PromptPrefix = 'Create a specification with streamlit functions creating markdow
221
  PromptPrefix2 = 'Create a streamlit python user app with full code listing to create a UI implementing the using streamlit, gradio, huggingface to create user interface elements like emoji buttons, sliders, drop downs, and data interfaces like dataframes to show tables, session_statematching this ruleset and thematic story plot line: '
222
  PromptPrefix3 = 'Create a HTML5 aframe and javascript app using appropriate libraries to create a word game simulation with advanced libraries like aframe to render 3d scenes creating moving entities that stay within a bounding box but show text and animation in 3d for inventory, components and story entities. Show full code listing. Add a list of new random entities say 3 of a few different types to any list appropriately and use emojis to make things easier and fun to read. Use appropriate emojis in labels. Create the UI to implement storytelling in the style of a dungeon master, with features using three emoji appropriate text plot twists and recurring interesting funny fascinating and complex almost poetic named characters with genius traits and file IO, randomness, ten point choice lists, math distribution tradeoffs, witty humorous dilemnas with emoji , rewards, variables, reusable functions with parameters, and data driven app with python libraries and streamlit components for Javascript and HTML5. Use appropriate emojis for labels to summarize and list parts, function, conditions for topic:'
223
 
224
- if st.checkbox(label='🎁Show Deities and Demigods Dataset', key='Deities'):
225
- Deities = DnD.DeitiesAndDemigods
226
- st.markdown(Deities)
227
-
228
  roleplaying_glossary = {
229
- "🤖 AI Concepts": {
230
- "MoE (Mixture of Experts) 🧠": [
231
- "What are Multi Agent Systems, Mixture of Experts, Semantic and Episodic Memory, and Mirroring in the context of AI and Health?",
232
- "How can AGI and AMI systems be created using MAS and MoE for Health?",
233
- "What are Self Rewarding AI Systems and their potential for Health?"
234
- ],
235
- "Multi Agent Systems (MAS) 🤝": [
236
- "What are some key characteristics and behaviors of Multi Agent Systems?",
237
- "What are distributed, autonomous, cooperative and competitive Multi Agent Systems?",
238
- "How are MAS applied in robotics, simulations, and decentralized problem-solving?"
239
- ],
240
- "Self Rewarding AI 🎁": [
241
- "What are some research areas and approaches in Self Rewarding AI systems?",
242
- "What is intrinsic motivation, autonomous goal setting, and curiosity-driven learning in Self Rewarding AI?",
243
- "How can Self Rewarding AI enable open-ended development?"
244
- ]
245
- },
246
- "🛠️ AI Tools & Platforms": {
247
- "AutoGen 🔧": [
248
- "What is AutoGen and how does it simplify the AI/ML development process?",
249
- "How accessible and automated is the AutoGen platform for AI creation?",
250
- "What data sources and model requirements does AutoGen support?"
251
- ],
252
- "ChatDev 💬": [
253
- "What is ChatDev and what features does it offer for building chatbots and conversational AI?",
254
- "What pre-built assets and integrations are available in ChatDev?",
255
- "How does ChatDev facilitate multi-platform chat development and analytics?"
256
- ],
257
- "Omniverse 🌐": [
258
- "What is Nvidia's Omniverse simulation platform and what industries and use cases does it support?",
259
- "How does Omniverse enable physically accurate virtual worlds and seamless collaboration?",
260
- "What AI training, testing and data exchange capabilities does Omniverse provide?"
261
- ]
262
- },
263
- "🔬 Science Topics": {
264
- "Physics 🔭": [
265
- "What are the main branches and research areas in Physics?",
266
- "What are key research areas in Astrophysics, Condensed Matter, and High Energy Physics?",
267
- "How do General Relativity, Quantum Cosmology, and Mathematical Physics interrelate?"
268
- ],
269
- "Mathematics ➗": [
270
- "What are the main branches of Mathematics?",
271
- "What are main branches of Algebra, Analysis, and Geometry in Mathematics?",
272
- "How do Probability, Statistics, and Applied Math relate to other Math fields?"
273
- ],
274
- "Computer Science 💻": [
275
- "What are the main research areas in Computer Science?",
276
- "What are major research topics in AI, Machine Learning, NLP, Vision, Graphics and Robotics?",
277
- "How do Algorithms, Data Structures, Databases, Distributed Systems and Programming Languages intersect?"
278
- ]
279
- }
280
  }
281
 
282
 
@@ -288,11 +266,11 @@ def display_glossary_entity(k):
288
  "🃏Analyst": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
289
  "📚PyCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
290
  "🔬JSCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
291
- "📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
292
- "🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
293
- "🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
294
- "🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
295
- "🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
296
  }
297
  links_md = ' '.join([f"[{emoji}]({url(k)})" for emoji, url in search_urls.items()])
298
  #st.markdown(f"{k} {links_md}", unsafe_allow_html=True)
@@ -306,12 +284,12 @@ def display_glossary_grid(roleplaying_glossary):
306
  "🃏Analyst": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
307
  "📚PyCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
308
  "🔬JSCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
309
- "📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
310
- "🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
311
- "▶️YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
312
- "🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
313
- "🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
314
- "🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
315
  }
316
 
317
  for category, details in roleplaying_glossary.items():
@@ -627,6 +605,10 @@ ShowSideImages=False
627
  if ShowSideImages:
628
  SideBarImageShuffle()
629
 
 
 
 
 
630
  # Ensure the directory for storing scores exists
631
  score_dir = "scores"
632
  os.makedirs(score_dir, exist_ok=True)
@@ -643,7 +625,7 @@ def update_score(key, increment=1):
643
  score_data = json.load(file)
644
  else:
645
  score_data = {"clicks": 0, "score": 0}
646
- score_data["clicks"] += 1
647
  score_data["score"] += increment
648
  with open(score_file, "w") as file:
649
  json.dump(score_data, file)
@@ -836,8 +818,6 @@ topic_emojis = {
836
 
837
  # Adjusted display_buttons_with_scores function
838
  def display_buttons_with_scores(num_columns_text):
839
-
840
-
841
  for category, games in roleplaying_glossary.items():
842
  category_emoji = topic_emojis.get(category, "🔍") # Default to search icon if no match
843
  st.markdown(f"## {category_emoji} {category}")
@@ -847,14 +827,9 @@ def display_buttons_with_scores(num_columns_text):
847
  key = f"{category}_{game}_{term}".replace(' ', '_').lower()
848
  score = load_score(key)
849
  if st.button(f"{game_emoji} {category} {game} {term} {score}", key=key):
850
- update_score(key)
851
- # Create a dynamic query incorporating emojis and formatting for clarity
852
  query_prefix = f"{category_emoji} {game_emoji} ** {category} - {game} - {term} - **"
853
- # ----------------------------------------------------------------------------------------------
854
- #query_body = f"Create a detailed outline for **{term}** with subpoints highlighting key aspects, using emojis for visual engagement. Include step-by-step rules and boldface important entities and ruleset elements."
855
- query_body = f"Create a streamlit python app.py that produces a detailed markdown outline and emoji laden user interface with labels with the entity name and emojis in all labels with a set of streamlit UI components with drop down lists and dataframes and buttons with expander and sidebar for the app to run the data as default values mostly in text boxes. Feature a 3 point outline sith 3 subpoints each where each line has about six words describing this and also contain appropriate emoji for creating sumamry of all aspeccts of this topic. an outline for **{term}** with subpoints highlighting key aspects, using emojis for visual engagement. Include step-by-step rules and boldface important entities and ruleset elements."
856
- response = search_glossary(query_prefix + query_body)
857
-
858
 
859
 
860
  def get_all_query_params(key):
@@ -1536,16 +1511,16 @@ if AddAFileForContext:
1536
  filename = generate_filename(f"{user_prompt}_section_{i+1}", choice)
1537
  create_file(filename, user_prompt, response, should_save)
1538
  st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
1539
-
 
 
1540
 
1541
- num_columns_video=st.slider(key="num_columns_video", label="Choose Number of Video Columns", min_value=1, max_value=15, value=4)
1542
  display_videos_and_links(num_columns_video) # Video Jump Grid
1543
 
1544
- num_columns_images=st.slider(key="num_columns_images", label="Choose Number of Image Columns", min_value=1, max_value=15, value=4)
1545
  display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
1546
 
1547
- display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid - Dynamically calculates columns based on details length to keep topic together
1548
-
1549
  num_columns_text=st.slider(key="num_columns_text", label="Choose Number of Text Columns", min_value=1, max_value=15, value=4)
1550
  display_buttons_with_scores(num_columns_text) # Feedback Jump Grid
1551
 
 
14
  import time
15
  import zipfile
16
  import dotenv
 
 
17
  from gradio_client import Client
18
  from audio_recorder_streamlit import audio_recorder
19
  from bs4 import BeautifulSoup
 
29
  from PIL import Image
30
  from urllib.parse import quote # Ensure this import is included
31
 
32
+ # 1. Configuration
33
  Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
34
  title="🔬🧠ScienceBrain.AI"
35
  helpURL='https://huggingface.co/awacke1'
 
48
  )
49
 
50
 
 
 
 
 
 
51
 
52
  # HTML5 based Speech Synthesis (Text to Speech in Browser)
53
  @st.cache_resource
 
82
  def parse_to_markdown(text):
83
  return text
84
 
85
+ def load_file(file_name):
86
+ with open(file_name, "r", encoding='utf-8') as file:
87
+ #with open(file_name, "r") as file:
88
+ content = file.read()
89
+ return content
90
 
91
  def extract_urls(text):
92
  try:
 
93
  date_pattern = re.compile(r'### (\d{2} \w{3} \d{4})')
94
  abs_link_pattern = re.compile(r'\[(.*?)\]\((https://arxiv\.org/abs/\d+\.\d+)\)')
95
  pdf_link_pattern = re.compile(r'\[⬇️\]\((https://arxiv\.org/pdf/\d+\.\d+)\)')
96
  title_pattern = re.compile(r'### \d{2} \w{3} \d{4} \| \[(.*?)\]')
 
 
97
  date_matches = date_pattern.findall(text)
98
  abs_link_matches = abs_link_pattern.findall(text)
99
  pdf_link_matches = pdf_link_pattern.findall(text)
100
  title_matches = title_pattern.findall(text)
101
 
102
+ # markdown with the extracted fields
103
  markdown_text = ""
104
  for i in range(len(date_matches)):
105
  date = date_matches[i]
106
  title = title_matches[i]
107
  abs_link = abs_link_matches[i][1]
108
  pdf_link = pdf_link_matches[i]
 
109
  markdown_text += f"**Date:** {date}\n\n"
110
  markdown_text += f"**Title:** {title}\n\n"
111
  markdown_text += f"**Abstract Link:** [{abs_link}]({abs_link})\n\n"
112
  markdown_text += f"**PDF Link:** [{pdf_link}]({pdf_link})\n\n"
113
  markdown_text += "---\n\n"
 
114
  return markdown_text
115
+
116
  except:
117
  st.write('.')
118
  return ''
119
 
 
 
120
  def download_pdfs(urls):
121
  local_files = []
122
  for url in urls:
 
140
  def search_arxiv(query):
141
  start_time = time.strftime("%Y-%m-%d %H:%M:%S")
142
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
 
 
 
143
  response1 = client.predict(
144
  query,
145
  20,
 
149
  )
150
  Question = '### 🔎 ' + query + '\r\n' # Format for markdown display with links
151
  References = response1[0]
 
 
152
  ReferenceLinks = extract_urls(References)
153
 
154
  RunSecondQuery = True
 
169
 
170
  st.write('🔍Run of Multi-Agent System Paper Summary Spec is Complete')
171
  end_time = time.strftime("%Y-%m-%d %H:%M:%S")
 
 
172
  start_timestamp = time.mktime(time.strptime(start_time, "%Y-%m-%d %H:%M:%S"))
173
  end_timestamp = time.mktime(time.strptime(end_time, "%Y-%m-%d %H:%M:%S"))
174
  elapsed_seconds = end_timestamp - start_timestamp
 
202
  PromptPrefix2 = 'Create a streamlit python user app with full code listing to create a UI implementing the using streamlit, gradio, huggingface to create user interface elements like emoji buttons, sliders, drop downs, and data interfaces like dataframes to show tables, session_statematching this ruleset and thematic story plot line: '
203
  PromptPrefix3 = 'Create a HTML5 aframe and javascript app using appropriate libraries to create a word game simulation with advanced libraries like aframe to render 3d scenes creating moving entities that stay within a bounding box but show text and animation in 3d for inventory, components and story entities. Show full code listing. Add a list of new random entities say 3 of a few different types to any list appropriately and use emojis to make things easier and fun to read. Use appropriate emojis in labels. Create the UI to implement storytelling in the style of a dungeon master, with features using three emoji appropriate text plot twists and recurring interesting funny fascinating and complex almost poetic named characters with genius traits and file IO, randomness, ten point choice lists, math distribution tradeoffs, witty humorous dilemnas with emoji , rewards, variables, reusable functions with parameters, and data driven app with python libraries and streamlit components for Javascript and HTML5. Use appropriate emojis for labels to summarize and list parts, function, conditions for topic:'
204
 
205
+ # MoE Roleplaying Technique for Context Experts
 
 
 
206
  roleplaying_glossary = {
207
+ "🤖 AI Concepts": {
208
+ "MoE (Mixture of Experts) 🧠": [
209
+ "As a leading researcher in AI and Health, provide an overview of Multi Agent Systems, Mixture of Experts, Semantic and Episodic Memory, and Mirroring, and their potential applications in the healthcare domain.",
210
+ "As an AI architect specializing in AGI and AMI systems, explain how MAS and MoE can be leveraged to create intelligent systems for healthcare applications.",
211
+ "As an expert in Self Rewarding AI, discuss the key concepts, potential benefits, and challenges of developing self-rewarding AI systems for healthcare."
212
+ ],
213
+ "Multi Agent Systems (MAS) 🤝": [
214
+ "As a renowned researcher in Multi Agent Systems, describe the key characteristics and behaviors of distributed, autonomous, cooperative, and competitive Multi Agent Systems.",
215
+ "As an AI engineer with experience in MAS, discuss how Multi Agent Systems are applied in robotics, simulations, and decentralized problem-solving.",
216
+ "As a thought leader in Multi Agent Systems, provide insights into the future trends and potential breakthroughs in MAS research and applications."
217
+ ],
218
+ "Self Rewarding AI 🎁": [
219
+ "As a leading expert in Self Rewarding AI, discuss the main research areas and approaches in developing AI systems with intrinsic motivation and autonomous goal-setting capabilities.",
220
+ "As an AI researcher specializing in curiosity-driven learning, explain how Self Rewarding AI can enable open-ended development and adaptability in AI systems.",
221
+ "As a pioneer in Self Rewarding AI, share your vision for the future of AI systems that can autonomously set goals, learn, and adapt to new challenges."
222
+ ]
223
+ },
224
+ "🛠️ AI Tools & Platforms": {
225
+ "AutoGen 🔧": [
226
+ "As the lead developer of AutoGen, provide an overview of how this platform simplifies the AI/ML development process and makes it more accessible and automated.",
227
+ "As an AI enthusiast curious about AutoGen, inquire about the data sources and model requirements supported by the platform.",
228
+ "As a potential user of AutoGen, ask about the key features and benefits of using this platform for AI development compared to traditional methods."
229
+ ],
230
+ "ChatDev 💬": [
231
+ "As a chatbot developer interested in ChatDev, ask about the features and capabilities offered by this platform for building conversational AI applications.",
232
+ "As a product manager evaluating ChatDev, inquire about the pre-built assets, integrations, and multi-platform support available in the platform.",
233
+ "As a business owner considering ChatDev, ask how this platform can facilitate the development, deployment, and analytics of chatbots across various channels and use cases."
234
+ ],
235
+ "Omniverse 🌐": [
236
+ "As a researcher in simulation technology, inquire about the industries and use cases supported by Nvidia's Omniverse platform.",
237
+ "As an engineer interested in Omniverse, ask how this platform enables the creation of physically accurate virtual worlds and facilitates seamless collaboration.",
238
+ "As an AI practitioner curious about Omniverse, inquire about the AI training, testing, and data exchange capabilities provided by the platform."
239
+ ]
240
+ },
241
+ "🔬 Science Topics": {
242
+ "Physics 🔭": [
243
+ "As a Physics student eager to explore the field, ask about the main branches and research areas in Physics and their interconnections.",
244
+ "As a researcher in Astrophysics, discuss the current state of research and future directions in this exciting subfield of Physics.",
245
+ "As a theorist working on the foundations of Physics, explain how General Relativity, Quantum Cosmology, and Mathematical Physics interrelate and shape our understanding of the universe."
246
+ ],
247
+ "Mathematics ➗": [
248
+ "As a Mathematics enthusiast, inquire about the main branches of Mathematics and their key research areas.",
249
+ "As a student interested in pure Mathematics, ask about the main branches of Algebra, Analysis, and Geometry, and their fundamental concepts and theories.",
250
+ "As an applied mathematician, discuss how Probability, Statistics, and Applied Math relate to other fields of Mathematics and their real-world applications."
251
+ ],
252
+ "Computer Science 💻": [
253
+ "As a Computer Science student exploring the field, ask about the main research areas and their significance in shaping the future of computing.",
254
+ "As an AI researcher, discuss the major research topics in AI, Machine Learning, NLP, Vision, Graphics, and Robotics, and their potential impact on various industries.",
255
+ "As a software engineer interested in the foundations of Computer Science, inquire about the interconnections between Algorithms, Data Structures, Databases, Distributed Systems, and Programming Languages."
256
+ ]
257
+ }
258
  }
259
 
260
 
 
266
  "🃏Analyst": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
267
  "📚PyCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
268
  "🔬JSCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
269
+ "📖": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
270
+ "🔍": lambda k: f"https://www.google.com/search?q={quote(k)}",
271
+ "🔎": lambda k: f"https://www.bing.com/search?q={quote(k)}",
272
+ "🎥": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
273
+ "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
274
  }
275
  links_md = ' '.join([f"[{emoji}]({url(k)})" for emoji, url in search_urls.items()])
276
  #st.markdown(f"{k} {links_md}", unsafe_allow_html=True)
 
284
  "🃏Analyst": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
285
  "📚PyCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
286
  "🔬JSCoder": lambda k: f"/?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
287
+ "📖": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
288
+ "🔍": lambda k: f"https://www.google.com/search?q={quote(k)}",
289
+ "▶️": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
290
+ "🔎": lambda k: f"https://www.bing.com/search?q={quote(k)}",
291
+ "🎥": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
292
+ "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
293
  }
294
 
295
  for category, details in roleplaying_glossary.items():
 
605
  if ShowSideImages:
606
  SideBarImageShuffle()
607
 
608
+
609
+
610
+ # Scoring for feedback: ----------------------------------------------------- emoji
611
+
612
  # Ensure the directory for storing scores exists
613
  score_dir = "scores"
614
  os.makedirs(score_dir, exist_ok=True)
 
625
  score_data = json.load(file)
626
  else:
627
  score_data = {"clicks": 0, "score": 0}
628
+ score_data["clicks"] += increment
629
  score_data["score"] += increment
630
  with open(score_file, "w") as file:
631
  json.dump(score_data, file)
 
818
 
819
  # Adjusted display_buttons_with_scores function
820
  def display_buttons_with_scores(num_columns_text):
 
 
821
  for category, games in roleplaying_glossary.items():
822
  category_emoji = topic_emojis.get(category, "🔍") # Default to search icon if no match
823
  st.markdown(f"## {category_emoji} {category}")
 
827
  key = f"{category}_{game}_{term}".replace(' ', '_').lower()
828
  score = load_score(key)
829
  if st.button(f"{game_emoji} {category} {game} {term} {score}", key=key):
830
+ newscore = update_score(key.replace('?',''))
 
831
  query_prefix = f"{category_emoji} {game_emoji} ** {category} - {game} - {term} - **"
832
+ st.markdown("Scored " + query_prefix + ' with score ' + str(newscore) + '.')
 
 
 
 
833
 
834
 
835
  def get_all_query_params(key):
 
1511
  filename = generate_filename(f"{user_prompt}_section_{i+1}", choice)
1512
  create_file(filename, user_prompt, response, should_save)
1513
  st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
1514
+
1515
+ display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid - Dynamically calculates columns based on details length to keep topic together
1516
+
1517
 
1518
+ num_columns_video=st.slider(key="num_columns_video", label="Choose Number of Video Columns", min_value=1, max_value=15, value=2)
1519
  display_videos_and_links(num_columns_video) # Video Jump Grid
1520
 
1521
+ num_columns_images=st.slider(key="num_columns_images", label="Choose Number of Image Columns", min_value=1, max_value=15, value=2)
1522
  display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
1523
 
 
 
1524
  num_columns_text=st.slider(key="num_columns_text", label="Choose Number of Text Columns", min_value=1, max_value=15, value=4)
1525
  display_buttons_with_scores(num_columns_text) # Feedback Jump Grid
1526