awacke1 commited on
Commit
8e33664
β€’
1 Parent(s): 7f6f911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
app.py CHANGED
@@ -132,8 +132,9 @@ def SpeechSynthesis(result):
132
 
133
 
134
  def search_arxiv(query):
 
 
135
  st.title("▢️ Semantic and Episodic Memory System")
136
-
137
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
138
 
139
  search_query = query
@@ -142,7 +143,6 @@ def search_arxiv(query):
142
  llm_model = st.selectbox("LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
143
 
144
  st.markdown('### πŸ”Ž ' + query)
145
- #if st.button("πŸ”Ž Search"):
146
  result = client.predict(
147
  search_query,
148
  top_n_results,
@@ -150,20 +150,10 @@ def search_arxiv(query):
150
  llm_model,
151
  api_name="/update_with_rag_md"
152
  )
153
-
154
- # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
155
-
156
  st.markdown(result)
157
-
158
-
159
  arxiv_results = st.text_area("ArXiv Results: ", value=result, height=700)
160
-
161
-
162
  SpeechSynthesis(result) # Search History Reader / Writer IO Memory - Audio at Same time as Reading.
163
-
164
-
165
- # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
166
-
167
  filename=generate_filename(result, "md")
168
  base_filename, ext = os.path.splitext(filename)
169
  with open(f"{base_filename}.md", 'w') as file:
@@ -172,6 +162,8 @@ def search_arxiv(query):
172
  file.write(content)
173
  except:
174
  st.write('.')
 
 
175
 
176
  #has_python_code = re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response)
177
  #has_python_code = bool(re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response))
@@ -183,10 +175,8 @@ def search_arxiv(query):
183
  # content = prompt.strip() + '\r\n' + response
184
  # file.write(content)
185
 
186
-
187
  create_file(filename, query, result, should_save)
188
 
189
-
190
  file_type = st.radio("Select Which Type of Memory You Prefer:", ("Semantic", "Episodic"))
191
  if st.button("Save"):
192
  file_name = save_file(result, file_type)
 
132
 
133
 
134
  def search_arxiv(query):
135
+ # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
136
+
137
  st.title("▢️ Semantic and Episodic Memory System")
 
138
  client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
139
 
140
  search_query = query
 
143
  llm_model = st.selectbox("LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
144
 
145
  st.markdown('### πŸ”Ž ' + query)
 
146
  result = client.predict(
147
  search_query,
148
  top_n_results,
 
150
  llm_model,
151
  api_name="/update_with_rag_md"
152
  )
 
 
 
153
  st.markdown(result)
 
 
154
  arxiv_results = st.text_area("ArXiv Results: ", value=result, height=700)
155
+ result = str(result) # cast as string for these - check content length and format if encoding changes..
 
156
  SpeechSynthesis(result) # Search History Reader / Writer IO Memory - Audio at Same time as Reading.
 
 
 
 
157
  filename=generate_filename(result, "md")
158
  base_filename, ext = os.path.splitext(filename)
159
  with open(f"{base_filename}.md", 'w') as file:
 
162
  file.write(content)
163
  except:
164
  st.write('.')
165
+ # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
166
+
167
 
168
  #has_python_code = re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response)
169
  #has_python_code = bool(re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response))
 
175
  # content = prompt.strip() + '\r\n' + response
176
  # file.write(content)
177
 
 
178
  create_file(filename, query, result, should_save)
179
 
 
180
  file_type = st.radio("Select Which Type of Memory You Prefer:", ("Semantic", "Episodic"))
181
  if st.button("Save"):
182
  file_name = save_file(result, file_type)