JBHF commited on
Commit
7617e6e
1 Parent(s): ba9e5ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -24
app.py CHANGED
@@ -257,30 +257,32 @@ document_chain = create_stuff_documents_chain(llm, prompt)
257
  retriever = st.session_state.vector.as_retriever()
258
  retrieval_chain = create_retrieval_chain(retriever, document_chain)
259
 
260
- prompt = st.text_input("Input your prompt here")
261
-
262
-
263
- # If the user hits enter
264
- if prompt:
265
- # Then pass the prompt to the LLM
266
- start = time.process_time()
267
- response = retrieval_chain.invoke({"input": prompt})
268
- # print(f"Response time: {time.process_time() - start}")
269
- st.write(f"Response time: {time.process_time() - start} seconds")
270
-
271
- st.write(response["answer"])
272
-
273
- # With a streamlit expander
274
- with st.expander("Document Similarity Search"):
275
- # Find the relevant chunks
276
- for i, doc in enumerate(response["context"]):
277
- # print(doc)
278
- # st.write(f"Source Document # {i+1} : {doc.metadata['source'].split('/')[-1]}")
279
- st.write(doc)
280
- st.write(f"Source Document # {i+1} : {doc.metadata['source'].split('/')[-1]}")
 
 
281
 
282
 
283
- st.write(doc.page_content)
284
- st.write("--------------------------------")
285
 
286
- st.write("---------------------------------")
 
257
  retriever = st.session_state.vector.as_retriever()
258
  retrieval_chain = create_retrieval_chain(retriever, document_chain)
259
 
260
+ while True:
261
+
262
+ prompt = st.text_input("Input your prompt here")
263
+
264
+
265
+ # If the user hits enter
266
+ if prompt:
267
+ # Then pass the prompt to the LLM
268
+ start = time.process_time()
269
+ response = retrieval_chain.invoke({"input": prompt})
270
+ # print(f"Response time: {time.process_time() - start}")
271
+ st.write(f"Response time: {time.process_time() - start} seconds")
272
+
273
+ st.write(response["answer"])
274
+
275
+ # With a streamlit expander
276
+ with st.expander("Document Similarity Search"):
277
+ # Find the relevant chunks
278
+ for i, doc in enumerate(response["context"]):
279
+ # print(doc)
280
+ # st.write(f"Source Document # {i+1} : {doc.metadata['source'].split('/')[-1]}")
281
+ st.write(doc)
282
+ st.write(f"Source Document # {i+1} : {doc.metadata['source'].split('/')[-1]}")
283
 
284
 
285
+ st.write(doc.page_content)
286
+ st.write("--------------------------------")
287
 
288
+ st.write("---------------------------------")