awacke1 commited on
Commit
22aaacf
β€’
1 Parent(s): c00f5a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -12
app.py CHANGED
@@ -50,6 +50,21 @@ from PIL import Image
50
  from urllib.parse import quote # Ensure this import is included
51
 
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  def save_file(content, file_type):
55
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -62,8 +77,19 @@ def load_file(file_name):
62
  with open(file_name, "r") as file:
63
  content = file.read()
64
  return content
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- def search_arxiv(query):
67
  st.title("▢️ Semantic and Episodic Memory System")
68
 
69
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
@@ -111,7 +137,7 @@ def search_arxiv(query):
111
 
112
  # Set page configuration with a title and favicon
113
  st.set_page_config(
114
- page_title="πŸ“–πŸ”WordGameAI",
115
  page_icon="πŸ”πŸ“–",
116
  layout="wide",
117
  initial_sidebar_state="expanded",
@@ -126,8 +152,8 @@ st.set_page_config(
126
  #PromptPrefix2 = 'Create a streamlit python app. Show full code listing. Create a UI implementing each feature creatively with python, streamlit, using variables and smart tables with word and idiom keys, creating reusable dense functions with graphic novel entity 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: '
127
 
128
  # Prompts for App, for App Product, and App Product Code
129
- PromptPrefix = 'Create a word game rule set and background story with streamlit markdown outlines and tables with appropriate emojis for methodical step by step rules defining the game play rules. Use story structure architect rules to plan, structure and write three dramatic situations to include in the word game rules matching the theme for topic of '
130
- PromptPrefix2 = 'Create a streamlit python user app with full code listing to create a UI implementing the plans, structure, situations and tables as python functions creating a word game with parts of speech and humorous word play which operates like word game rules and creates a compelling fun story using streamlit to create user interface elements like emoji buttons, sliders, drop downs, and data interfaces like dataframes to show tables, session_state to track inventory, character advancement and experience, locations, file_uploader to allow the user to add images which are saved and referenced shown in gallery, camera_input to take character picture, on_change = function callbacks with continual running plots that change when you change data or click a button, randomness and word and letter rolls using emojis and st.markdown, st.expander for groupings and clusters of things, st.columns and other UI controls in streamlit as a game. Create inline data tables and list dictionaries for entities implemented as variables for the word game rule entities and stats. Design it as a fun data driven game app and show full python code listing for this ruleset and thematic story plot line: '
131
  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:'
132
 
133
  # Function to display the entire glossary in a grid format with links
@@ -173,7 +199,7 @@ def display_glossary_entity(k):
173
 
174
 
175
 
176
- #st.markdown('''### πŸ“–βœ¨πŸ” WordGameAI ''')
177
  #with st.expander("Help / About πŸ“š", expanded=False):
178
  # st.markdown('''
179
  # - πŸš€ **Unlock Words:** Elevate your vocabulary with AI. Turns words into thrilling experiences.
@@ -367,7 +393,7 @@ def get_table_download_link(file_path):
367
 
368
  @st.cache_resource
369
  def create_zip_of_files(files): # ----------------------------------
370
- zip_name = "WordGameAI.zip"
371
  with zipfile.ZipFile(zip_name, 'w') as zipf:
372
  for file in files:
373
  zipf.write(file)
@@ -692,7 +718,7 @@ def display_glossary_grid(roleplaying_glossary):
692
  "πŸ”": lambda k: f"https://www.google.com/search?q={quote(k)}",
693
  "▢️": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
694
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
695
- "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/MixableWordGameAI?q={quote(k)}", # this url plus query!
696
 
697
  }
698
 
@@ -840,7 +866,7 @@ def create_search_url_google(keyword):
840
  return base_url + keyword.replace(' ', '+')
841
 
842
  def create_search_url_ai(keyword):
843
- base_url = "https://huggingface.co/spaces/awacke1/MixableWordGameAI?q="
844
  return base_url + keyword.replace(' ', '+')
845
 
846
  def display_images_and_wikipedia_summaries():
@@ -1264,11 +1290,23 @@ def StreamMedChatResponse(topic):
1264
 
1265
 
1266
  # 17. Main
1267
- def arxivmain(query):
1268
- prompt = query
 
 
 
 
 
 
 
 
 
 
 
 
 
1269
  with st.expander("Prompts πŸ“š", expanded=True):
1270
 
1271
- search_arxiv(query)
1272
 
1273
  example_input = st.text_input("Enter your prompt text:", value=prompt, help="Enter text to get a response.")
1274
  if st.button("Run Prompt", help="Click to run."):
@@ -1404,7 +1442,7 @@ except:
1404
 
1405
  # Display the glossary grid
1406
  st.markdown("### πŸŽ²πŸ—ΊοΈ Arxiv Paper Search QA RAG MAS using Streamlit and Gradio API")
1407
-
1408
  display_videos_and_links() # Video Jump Grid
1409
  display_images_and_wikipedia_summaries() # Image Jump Grid
1410
  display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid
 
50
  from urllib.parse import quote # Ensure this import is included
51
 
52
 
53
+ ## Show examples
54
+ sample_outputs = {
55
+ 'output_placeholder': 'The LLM will provide an answer to your question here...',
56
+ 'search_placeholder': '''
57
+ 1. What is MoE?
58
+ 2. What are Multi Agent Systems?
59
+ 3. What is Self Rewarding AI?
60
+ 4. What is Semantic and Episodic memory?
61
+ 5. What is AutoGen?
62
+ 6. What is ChatDev?
63
+ 7. What is Omniverse?
64
+ 8. What is Lumiere?
65
+ 9. What is SORA?
66
+ '''
67
+ }
68
 
69
  def save_file(content, file_type):
70
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
 
77
  with open(file_name, "r") as file:
78
  content = file.read()
79
  return content
80
+ #import streamlit as st
81
+ #from gradio_client import Client
82
+ #client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
83
+ #result = client.predict(
84
+ # "What is Semantic and Episodic memory?", # str in 'Search' Textbox component
85
+ # 4, # float (numeric value between 4 and 10) in 'Top n results as context' Slider component
86
+ # "Semantic Search - up to 10 Mar 2024", # Literal['Semantic Search - up to 10 Mar 2024', 'Arxiv Search - Latest - (EXPERIMENTAL)'] in 'Search Source' Dropdown component
87
+ # "mistralai/Mixtral-8x7B-Instruct-v0.1", # Literal['mistralai/Mixtral-8x7B-Instruct-v0.1', 'mistralai/Mistral-7B-Instruct-v0.2', 'google/gemma-7b-it', 'None'] in 'LLM Model' Dropdown component
88
+ # api_name="/update_with_rag_md"
89
+ #)
90
+ #st.markdown(result)
91
 
92
+ def search_arxiv():
93
  st.title("▢️ Semantic and Episodic Memory System")
94
 
95
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
 
137
 
138
  # Set page configuration with a title and favicon
139
  st.set_page_config(
140
+ page_title="πŸ“–πŸ”Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-APAI",
141
  page_icon="πŸ”πŸ“–",
142
  layout="wide",
143
  initial_sidebar_state="expanded",
 
152
  #PromptPrefix2 = 'Create a streamlit python app. Show full code listing. Create a UI implementing each feature creatively with python, streamlit, using variables and smart tables with word and idiom keys, creating reusable dense functions with graphic novel entity 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: '
153
 
154
  # Prompts for App, for App Product, and App Product Code
155
+ PromptPrefix = 'Create a speccification with streamlit functions creating markdown outlines and tables rich with appropriate emojis for methodical step by step rules defining the concepts at play. Use story structure architect rules to plan, structure and write three dramatic situations to include in the rules and how to play by matching the theme for topic of '
156
+ PromptPrefix2 = 'Create a streamlit python user app with full code listing to create a UI implementing the using streamlit or gradio or huggingface to create user interface elements like emoji buttons, sliders, drop downs, and data interfaces like dataframes to show tables, session_state to track inventory, character advancement and experience, locations, file_uploader to allow the user to add images which are saved and referenced shown in gallery, camera_input to take character picture, on_change = function callbacks with continual running plots that change when you change data or click a button, randomness and word and letter rolls using emojis and st.markdown, st.expander for groupings and clusters of things, st.columns and other UI controls in streamlit as a game. Create inline data tables and list dictionaries for entities implemented as variables for the word game rule entities and stats. Design it as a fun data driven game app and show full python code listing for this ruleset and thematic story plot line: '
157
  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:'
158
 
159
  # Function to display the entire glossary in a grid format with links
 
199
 
200
 
201
 
202
+ #st.markdown('''### πŸ“–βœ¨πŸ” Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-AP ''')
203
  #with st.expander("Help / About πŸ“š", expanded=False):
204
  # st.markdown('''
205
  # - πŸš€ **Unlock Words:** Elevate your vocabulary with AI. Turns words into thrilling experiences.
 
393
 
394
  @st.cache_resource
395
  def create_zip_of_files(files): # ----------------------------------
396
+ zip_name = "Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-AP.zip"
397
  with zipfile.ZipFile(zip_name, 'w') as zipf:
398
  for file in files:
399
  zipf.write(file)
 
718
  "πŸ”": lambda k: f"https://www.google.com/search?q={quote(k)}",
719
  "▢️": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
720
  "πŸ”Ž": lambda k: f"https://www.bing.com/search?q={quote(k)}",
721
+ "🎲": lambda k: f"https://huggingface.co/spaces/awacke1/Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-AP?q={quote(k)}", # this url plus query!
722
 
723
  }
724
 
 
866
  return base_url + keyword.replace(' ', '+')
867
 
868
  def create_search_url_ai(keyword):
869
+ base_url = "https://huggingface.co/spaces/awacke1/Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-AP?q="
870
  return base_url + keyword.replace(' ', '+')
871
 
872
  def display_images_and_wikipedia_summaries():
 
1290
 
1291
 
1292
  # 17. Main
1293
+ def arxivmain():
1294
+ prompt = '''
1295
+
1296
+ What is MoE?
1297
+ What are Multi Agent Systems?
1298
+ What is Self Rewarding AI?
1299
+ What is Semantic and Episodic memory?
1300
+ What is AutoGen?
1301
+ What is ChatDev?
1302
+ What is Omniverse?
1303
+ What is Lumiere?
1304
+ What is SORA?
1305
+
1306
+
1307
+ '''
1308
  with st.expander("Prompts πŸ“š", expanded=True):
1309
 
 
1310
 
1311
  example_input = st.text_input("Enter your prompt text:", value=prompt, help="Enter text to get a response.")
1312
  if st.button("Run Prompt", help="Click to run."):
 
1442
 
1443
  # Display the glossary grid
1444
  st.markdown("### πŸŽ²πŸ—ΊοΈ Arxiv Paper Search QA RAG MAS using Streamlit and Gradio API")
1445
+ arxivmain()
1446
  display_videos_and_links() # Video Jump Grid
1447
  display_images_and_wikipedia_summaries() # Image Jump Grid
1448
  display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid