Update app.py
Browse files
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 |
-
"
|
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 |
-
"
|
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 |
-
"
|
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, [])
|