oliverdixon commited on
Commit
ae15fae
·
1 Parent(s): 302d53c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -18
app.py CHANGED
@@ -177,7 +177,7 @@ def vector_search(question):
177
  filenames_with_extension = [os.path.basename(source) for source in sources_list]
178
  filename_without_extension = [os.path.splitext(source)[0] for source in filenames_with_extension]
179
  filtered_sources = [source for source in filename_without_extension if source]
180
- cleaned_sources = "; ".join(filtered_sources)
181
 
182
  else:
183
  pass
@@ -194,21 +194,10 @@ def combined_answer(text1, text2, text3, source, question):
194
  Text3 {} \n
195
  Combined, summarized text:'''.format(question,text1,text_answer2,text3)
196
  result = llm.predict(text)
197
- sources = '''Combine the following information in order to produce a buller list of all the sources? \n
198
- With each source being on a seprate line \n
199
- Here are the sources: \n
200
- Source1 {} \n
201
- Source2 {} \n
202
- Example:
203
- ###
204
- Sources:
205
- - The NIV Application Commentary: Joshua by Robert L. Hubbard, Jr
206
- - https://www.desiringgod.org/articles/loud-and-quiet-women
207
- ###
208
- Sources:'''.format(text2['sources'],source)
209
- source_output = llm.predict(sources)
210
 
211
- return result, source_output
212
 
213
  with st.form("my_form"):
214
  text = st.text_area("Enter text:", "Type question here")
@@ -220,10 +209,11 @@ with st.form("my_form"):
220
  text1 = generate_response(text)
221
  text2 = web_search(text)
222
  text3, source = vector_search(text)
223
- answer, source2 = combined_answer(text1, text2, text3, source,text)
224
  st.info(answer)
225
- st.info(source2)
226
-
 
227
  st.markdown("## Examples")
228
  example1 = "Give me a Hebrew word study of Psalm 23"
229
  example2 = "Give me a Greek word study on John 17:1-5"
 
177
  filenames_with_extension = [os.path.basename(source) for source in sources_list]
178
  filename_without_extension = [os.path.splitext(source)[0] for source in filenames_with_extension]
179
  filtered_sources = [source for source in filename_without_extension if source]
180
+ cleaned_sources = "\n- ".join(filtered_sources)
181
 
182
  else:
183
  pass
 
194
  Text3 {} \n
195
  Combined, summarized text:'''.format(question,text1,text_answer2,text3)
196
  result = llm.predict(text)
197
+ books_ref = source
198
+ web_ref = text2['sources']
 
 
 
 
 
 
 
 
 
 
 
199
 
200
+ return result, books_ref, web_ref
201
 
202
  with st.form("my_form"):
203
  text = st.text_area("Enter text:", "Type question here")
 
209
  text1 = generate_response(text)
210
  text2 = web_search(text)
211
  text3, source = vector_search(text)
212
+ answer, source2, source3 = combined_answer(text1, text2, text3, source,text)
213
  st.info(answer)
214
+ st.info(f"Web Sources:\n {source3}")
215
+ st.info(f"Book Sources:\n {source2}")
216
+
217
  st.markdown("## Examples")
218
  example1 = "Give me a Hebrew word study of Psalm 23"
219
  example2 = "Give me a Greek word study on John 17:1-5"