eaglelandsonce commited on
Commit
395b8cd
·
1 Parent(s): 08b2db5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -84,7 +84,31 @@ if submit:
84
  if st.session_state['Website_URL'] !="" and st.session_state['HuggingFace_API_Key'] !="" and st.session_state['Pinecone_ENV'] !="" and st.session_state['Pinecone_API_Key']!="" and st.session_state['API_Key'] != '':
85
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
 
 
88
  q = st.text_input('Ask a question about the content of your file:')
89
  if q: # if the user entered a question and hit enter
90
  if 'vs' in st.session_state: # if there's the vector store (user uploaded, split and embedded a file)
@@ -113,7 +137,7 @@ if submit:
113
  # text area widget for the chat history
114
  st.text_area(label='Chat History', value=h, key='history', height=400)
115
 
116
- '''
117
 
118
  #Creating embeddings instance
119
  embeddings=create_embeddings()
 
84
  if st.session_state['Website_URL'] !="" and st.session_state['HuggingFace_API_Key'] !="" and st.session_state['Pinecone_ENV'] !="" and st.session_state['Pinecone_API_Key']!="" and st.session_state['API_Key'] != '':
85
 
86
 
87
+ #Creating embeddings instance
88
+ embeddings=create_embeddings()
89
+ st.write("Embeddings instance creation done...")
90
+
91
+ #Pull index data from Pinecone
92
+ index=pull_from_pinecone(st.session_state['Pinecone_API_Key'],st.session_state['Pinecone_ENV'],st.session_state['Pinecone_Index'],embeddings)
93
+ st.write("Pinecone index retrieval done...")
94
+
95
+ #Fetch relavant documents from Pinecone index
96
+ relavant_docs=get_similar_docs(index,prompt,document_count)
97
+ st.write(relavant_docs)
98
+
99
+ #Displaying search results
100
+ st.success("Please find the search results :")
101
+ #Displaying search results
102
+ st.write("search results list....")
103
+ for document in relavant_docs:
104
+
105
+ st.write("👉**Result : "+ str(relavant_docs.index(document)+1)+"**")
106
+ st.write("**Info**: "+document.page_content)
107
+ st.write("**Link**: "+ document.metadata['source'])
108
+
109
 
110
+
111
+ '''
112
  q = st.text_input('Ask a question about the content of your file:')
113
  if q: # if the user entered a question and hit enter
114
  if 'vs' in st.session_state: # if there's the vector store (user uploaded, split and embedded a file)
 
137
  # text area widget for the chat history
138
  st.text_area(label='Chat History', value=h, key='history', height=400)
139
 
140
+
141
 
142
  #Creating embeddings instance
143
  embeddings=create_embeddings()