awacke1 commited on
Commit
6d4b42b
β€’
1 Parent(s): d9ce3c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -35
app.py CHANGED
@@ -32,7 +32,10 @@ from urllib.parse import quote # Ensure this import is included
32
 
33
 
34
  # 1. Configuration
 
 
35
  title="πŸš€πŸŒŒArXiv Article Document Search Memory"
 
36
  helpURL='https://huggingface.co/awacke1'
37
  bugURL='https://huggingface.co/spaces/awacke1'
38
  icons='πŸ”πŸš€πŸŒŒπŸ“–'
@@ -162,7 +165,6 @@ PromptPrefix3 = 'Create a HTML5 aframe and javascript app using appropriate libr
162
 
163
  # Function to display the entire glossary in a grid format with links
164
 
165
- Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
166
  def display_glossary_grid(roleplaying_glossary):
167
  search_urls = {
168
  "πŸ“–": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
@@ -171,7 +173,7 @@ def display_glossary_grid(roleplaying_glossary):
171
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
172
  "πŸŽ₯": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
173
  "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
174
- "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}", # this url plus query!
175
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
176
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
177
  "πŸ”¬": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
@@ -197,7 +199,7 @@ def display_glossary_entity(k):
197
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
198
  "πŸŽ₯": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
199
  "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
200
- "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}", # this url plus query!
201
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
202
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
203
  "πŸ”¬": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
@@ -686,12 +688,17 @@ def display_glossary(glossary, area):
686
  # Function to display the entire glossary in a grid format with links
687
  def display_glossary_grid(roleplaying_glossary):
688
  search_urls = {
689
- "πŸ“–": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
690
- "πŸ”": lambda k: f"https://www.google.com/search?q={quote(k)}",
691
- "▢️": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
692
- "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
693
- "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/World-Ship-Design?q={quote(k)}", # this url plus query!
694
-
 
 
 
 
 
695
  }
696
 
697
  for category, details in roleplaying_glossary.items():
@@ -702,7 +709,7 @@ def display_glossary_grid(roleplaying_glossary):
702
  st.markdown(f"#### {game}")
703
  for term in terms:
704
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
705
- st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
706
 
707
 
708
  @st.cache_resource
@@ -814,31 +821,6 @@ def display_buttons_with_scores():
814
  response = search_glossary(query_prefix + query_body)
815
 
816
 
817
- def fetch_wikipedia_summary(keyword):
818
- # Placeholder function for fetching Wikipedia summaries
819
- # In a real app, you might use requests to fetch from the Wikipedia API
820
- return f"Summary for {keyword}. For more information, visit Wikipedia."
821
-
822
- def create_search_url_youtube(keyword):
823
- base_url = "https://www.youtube.com/results?search_query="
824
- return base_url + keyword.replace(' ', '+')
825
-
826
- def create_search_url_bing(keyword):
827
- base_url = "https://www.bing.com/search?q="
828
- return base_url + keyword.replace(' ', '+')
829
-
830
- def create_search_url_wikipedia(keyword):
831
- base_url = "https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search="
832
- return base_url + keyword.replace(' ', '+')
833
-
834
- def create_search_url_google(keyword):
835
- base_url = "https://www.google.com/search?q="
836
- return base_url + keyword.replace(' ', '+')
837
-
838
- def create_search_url_ai(keyword):
839
- base_url = "https://huggingface.co/spaces/awacke1/World-Ship-Design?q="
840
- return base_url + keyword.replace(' ', '+')
841
-
842
 
843
  def get_all_query_params(key):
844
  return st.query_params().get(key, [])
 
32
 
33
 
34
  # 1. Configuration
35
+
36
+ Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
37
  title="πŸš€πŸŒŒArXiv Article Document Search Memory"
38
+
39
  helpURL='https://huggingface.co/awacke1'
40
  bugURL='https://huggingface.co/spaces/awacke1'
41
  icons='πŸ”πŸš€πŸŒŒπŸ“–'
 
165
 
166
  # Function to display the entire glossary in a grid format with links
167
 
 
168
  def display_glossary_grid(roleplaying_glossary):
169
  search_urls = {
170
  "πŸ“–": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
 
173
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
174
  "πŸŽ₯": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
175
  "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
176
+ "πŸš€πŸŒŒArXiv": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}", # this url plus query!
177
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
178
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
179
  "πŸ”¬": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
 
199
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
200
  "πŸŽ₯": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
201
  "🐦": lambda k: f"https://twitter.com/search?q={quote(k)}",
202
+ "πŸš€πŸŒŒArXiv": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}", # this url plus query!
203
  "πŸƒ": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
204
  "πŸ“š": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
205
  "πŸ”¬": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
 
688
  # Function to display the entire glossary in a grid format with links
689
  def display_glossary_grid(roleplaying_glossary):
690
  search_urls = {
691
+ "πŸ“–Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
692
+ "πŸ”Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
693
+ "▢️YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
694
+ "πŸ”ŽBing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
695
+ "πŸŽ₯YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
696
+ "🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
697
+ "πŸš€πŸŒŒArXiv": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}", # this url plus query!
698
+ "πŸƒAnalyst": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix)}", # this url plus query!
699
+ "πŸ“šPyCoder": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix2)}", # this url plus query!
700
+ "πŸ”¬JSCoder": lambda k: f"https://huggingface.co/spaces/awacke1/{Site_Name}?q={quote(k)}-{quote(PromptPrefix3)}", # this url plus query!
701
+
702
  }
703
 
704
  for category, details in roleplaying_glossary.items():
 
709
  st.markdown(f"#### {game}")
710
  for term in terms:
711
  links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
712
+ st.markdown(f"**{term}** <small>{links_md}</small>", unsafe_allow_html=True)
713
 
714
 
715
  @st.cache_resource
 
821
  response = search_glossary(query_prefix + query_body)
822
 
823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
 
825
  def get_all_query_params(key):
826
  return st.query_params().get(key, [])