Update app.py
Browse files
app.py
CHANGED
@@ -169,7 +169,6 @@ def display_glossary_grid(roleplaying_glossary):
|
|
169 |
search_urls = {
|
170 |
"📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
|
171 |
"🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
|
172 |
-
"▶️YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
173 |
"🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
|
174 |
"🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
175 |
"🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
|
@@ -197,7 +196,6 @@ def display_glossary_entity(k):
|
|
197 |
search_urls = {
|
198 |
"📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
|
199 |
"🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
|
200 |
-
"▶️YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
201 |
"🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
|
202 |
"🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
203 |
"🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
|
@@ -431,8 +429,8 @@ def FileSidebar():
|
|
431 |
file_contents=''
|
432 |
file_name=''
|
433 |
next_action=''
|
434 |
-
|
435 |
-
# FileSidebar Adds files matching pattern to sidebar where we feature a 🌐View, 📂Open,
|
436 |
for file in all_files:
|
437 |
col1, col2, col3, col4, col5 = st.sidebar.columns([1,6,1,1,1]) # adjust the ratio as needed
|
438 |
with col1:
|
@@ -453,7 +451,7 @@ def FileSidebar():
|
|
453 |
st.session_state['filetext'] = file_contents
|
454 |
st.session_state['next_action'] = next_action
|
455 |
with col4:
|
456 |
-
if st.button("
|
457 |
file_contents = load_file(file)
|
458 |
file_name=file
|
459 |
next_action='search'
|
@@ -497,7 +495,8 @@ def FileSidebar():
|
|
497 |
#search_glossary(file_content_area)
|
498 |
filesearch = PromptPrefix + file_content_area
|
499 |
st.markdown(filesearch)
|
500 |
-
|
|
|
501 |
search_glossary(filesearch)
|
502 |
|
503 |
if next_action=='md':
|
@@ -525,7 +524,7 @@ def FileSidebar():
|
|
525 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
526 |
|
527 |
# Bass Drum Title -
|
528 |
-
st.markdown("""
|
529 |
|
530 |
|
531 |
FileSidebar()
|
@@ -599,11 +598,13 @@ def load_score(key):
|
|
599 |
# 🔍Run--------------------------------------------------------
|
600 |
@st.cache_resource
|
601 |
def search_glossary(query):
|
602 |
-
for category, terms in roleplaying_glossary.items():
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
all=""
|
|
|
|
|
607 |
|
608 |
# 🔍Run 1 - plain query
|
609 |
#response = chat_with_model(query)
|
@@ -620,7 +621,7 @@ def search_glossary(query):
|
|
620 |
api_name="/ask_llm"
|
621 |
)
|
622 |
st.write('🔍Run of Multi-Agent System Paper Summary Spec is Complete')
|
623 |
-
|
624 |
|
625 |
# ArXiv searcher ~-<>-~ Paper References - Update with RAG
|
626 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
@@ -696,6 +697,7 @@ def display_glossary_grid(roleplaying_glossary):
|
|
696 |
for category, details in roleplaying_glossary.items():
|
697 |
st.write(f"### {category}")
|
698 |
cols = st.columns(len(details)) # Create dynamic columns based on the number of games
|
|
|
699 |
for idx, (game, terms) in enumerate(details.items()):
|
700 |
with cols[idx]:
|
701 |
st.markdown(f"#### {game}")
|
@@ -705,14 +707,13 @@ def display_glossary_grid(roleplaying_glossary):
|
|
705 |
|
706 |
|
707 |
@st.cache_resource
|
708 |
-
def display_videos_and_links():
|
709 |
video_files = [f for f in os.listdir('.') if f.endswith('.mp4')]
|
710 |
if not video_files:
|
711 |
st.write("No MP4 videos found in the current directory.")
|
712 |
return
|
713 |
|
714 |
video_files_sorted = sorted(video_files, key=lambda x: len(x.split('.')[0]))
|
715 |
-
num_columns=4
|
716 |
cols = st.columns(num_columns) # Define num_columns columns outside the loop
|
717 |
col_index = 0 # Initialize column index
|
718 |
|
@@ -794,7 +795,9 @@ topic_emojis = {
|
|
794 |
}
|
795 |
|
796 |
# Adjusted display_buttons_with_scores function
|
797 |
-
def display_buttons_with_scores():
|
|
|
|
|
798 |
for category, games in roleplaying_glossary.items():
|
799 |
category_emoji = topic_emojis.get(category, "🔍") # Default to search icon if no match
|
800 |
st.markdown(f"## {category_emoji} {category}")
|
@@ -1417,8 +1420,13 @@ if len(document_sections) > 0:
|
|
1417 |
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
1418 |
|
1419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1420 |
|
1421 |
-
|
1422 |
-
|
1423 |
-
display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid
|
1424 |
-
display_buttons_with_scores() # Feedback Jump Grid
|
|
|
169 |
search_urls = {
|
170 |
"📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
|
171 |
"🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
|
|
|
172 |
"🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
|
173 |
"🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
174 |
"🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
|
|
|
196 |
search_urls = {
|
197 |
"📖Wiki": lambda k: f"https://en.wikipedia.org/wiki/{quote(k)}",
|
198 |
"🔍Google": lambda k: f"https://www.google.com/search?q={quote(k)}",
|
|
|
199 |
"🔎Bing": lambda k: f"https://www.bing.com/search?q={quote(k)}",
|
200 |
"🎥YouTube": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
|
201 |
"🐦Twitter": lambda k: f"https://twitter.com/search?q={quote(k)}",
|
|
|
429 |
file_contents=''
|
430 |
file_name=''
|
431 |
next_action=''
|
432 |
+
|
433 |
+
# FileSidebar Adds files matching pattern to sidebar where we feature a 🌐View, 📂Open, ▶️Run, and 🗑Delete per file
|
434 |
for file in all_files:
|
435 |
col1, col2, col3, col4, col5 = st.sidebar.columns([1,6,1,1,1]) # adjust the ratio as needed
|
436 |
with col1:
|
|
|
451 |
st.session_state['filetext'] = file_contents
|
452 |
st.session_state['next_action'] = next_action
|
453 |
with col4:
|
454 |
+
if st.button("▶️", key="read_"+file): # search emoji button
|
455 |
file_contents = load_file(file)
|
456 |
file_name=file
|
457 |
next_action='search'
|
|
|
495 |
#search_glossary(file_content_area)
|
496 |
filesearch = PromptPrefix + file_content_area
|
497 |
st.markdown(filesearch)
|
498 |
+
|
499 |
+
if st.button(key=rerun, label='🔍AI Search' ):
|
500 |
search_glossary(filesearch)
|
501 |
|
502 |
if next_action=='md':
|
|
|
524 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
525 |
|
526 |
# Bass Drum Title -
|
527 |
+
st.markdown("""**🎺🎷 The Sounds 🎹🥁 of the Big Easy 🎭🎉 🎼🎸 NOLA's Iconic 🎤🪕 Musical 🔊 Heritage 🏰 🎺🪘 Crescent City 🌙 Rhythms & Grooves 🎹💃 🎷🎸 Mardi Gras 🎭 Melodies: 🎼🎺 Straight Outta Nawlins ⚜️ 🥁🎻 Jazzy 🎷 Jambalaya 🍛 of New Orleans' 🏰 Musical 🎹 Soul 🙌The Music Of New Orleans MoE**""")
|
528 |
|
529 |
|
530 |
FileSidebar()
|
|
|
598 |
# 🔍Run--------------------------------------------------------
|
599 |
@st.cache_resource
|
600 |
def search_glossary(query):
|
601 |
+
#for category, terms in roleplaying_glossary.items():
|
602 |
+
# if query.lower() in (term.lower() for term in terms):
|
603 |
+
# st.markdown(f"#### {category}")
|
604 |
+
# st.write(f"- {query}")
|
605 |
all=""
|
606 |
+
st.markdown(f"- {query}")
|
607 |
+
|
608 |
|
609 |
# 🔍Run 1 - plain query
|
610 |
#response = chat_with_model(query)
|
|
|
621 |
api_name="/ask_llm"
|
622 |
)
|
623 |
st.write('🔍Run of Multi-Agent System Paper Summary Spec is Complete')
|
624 |
+
st.markdown(response2)
|
625 |
|
626 |
# ArXiv searcher ~-<>-~ Paper References - Update with RAG
|
627 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
|
|
697 |
for category, details in roleplaying_glossary.items():
|
698 |
st.write(f"### {category}")
|
699 |
cols = st.columns(len(details)) # Create dynamic columns based on the number of games
|
700 |
+
#cols = st.columns(num_columns_text) # Create dynamic columns based on the number of games
|
701 |
for idx, (game, terms) in enumerate(details.items()):
|
702 |
with cols[idx]:
|
703 |
st.markdown(f"#### {game}")
|
|
|
707 |
|
708 |
|
709 |
@st.cache_resource
|
710 |
+
def display_videos_and_links(num_columns):
|
711 |
video_files = [f for f in os.listdir('.') if f.endswith('.mp4')]
|
712 |
if not video_files:
|
713 |
st.write("No MP4 videos found in the current directory.")
|
714 |
return
|
715 |
|
716 |
video_files_sorted = sorted(video_files, key=lambda x: len(x.split('.')[0]))
|
|
|
717 |
cols = st.columns(num_columns) # Define num_columns columns outside the loop
|
718 |
col_index = 0 # Initialize column index
|
719 |
|
|
|
795 |
}
|
796 |
|
797 |
# Adjusted display_buttons_with_scores function
|
798 |
+
def display_buttons_with_scores(num_columns_text):
|
799 |
+
|
800 |
+
|
801 |
for category, games in roleplaying_glossary.items():
|
802 |
category_emoji = topic_emojis.get(category, "🔍") # Default to search icon if no match
|
803 |
st.markdown(f"## {category_emoji} {category}")
|
|
|
1420 |
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
1421 |
|
1422 |
|
1423 |
+
num_columns_video=st.slider(key="num_columns_video", label="Choose Number of Video Columns", min_value=1, max_value=10, value=2)
|
1424 |
+
display_videos_and_links(num_columns_video) # Video Jump Grid
|
1425 |
+
|
1426 |
+
num_columns_images=st.slider(key="num_columns_images", label="Choose Number of Image Columns", min_value=1, max_value=10, value=4)
|
1427 |
+
display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
|
1428 |
+
|
1429 |
+
display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid - Dynamically calculates columns based on details length to keep topic together
|
1430 |
|
1431 |
+
num_columns_text=st.slider(key="num_columns_text", label="Choose Number of Text Columns", min_value=1, max_value=10, value=4)
|
1432 |
+
display_buttons_with_scores(num_columns_text) # Feedback Jump Grid
|
|
|
|