ali121300 commited on
Commit
e611426
1 Parent(s): 4ac050d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -130,7 +130,18 @@ def sentences_f(sentence,df2):
130
  df1['معادل'] = df1.apply(lambda row: row['کلمات'] if row['معادل'] == '' else row['معادل'], axis=1)
131
  translated_sentence = ' '.join(df1['معادل'].tolist())
132
  return translated_sentence
 
 
 
133
 
 
 
 
 
 
 
 
 
134
  ####################################################################################################################
135
  def main():
136
  st.set_page_config(
@@ -159,9 +170,11 @@ def main():
159
  if st.button("Answer"):
160
  with st.spinner("Answering"):
161
  handle_userinput(user_question)
 
162
  if st.button("CLEAR"):
163
  with st.spinner("CLEARING"):
164
  st.cache_data.clear()
 
165
 
166
 
167
  with st.sidebar:
 
130
  df1['معادل'] = df1.apply(lambda row: row['کلمات'] if row['معادل'] == '' else row['معادل'], axis=1)
131
  translated_sentence = ' '.join(df1['معادل'].tolist())
132
  return translated_sentence
133
+ ######################################################################################
134
+ def process():
135
+ raw_text = get_pdf_text(pdf_docs)
136
 
137
+ # get the text chunks
138
+ text_chunks = get_text_chunks(raw_text)
139
+
140
+ # create vector store
141
+ vectorstore = get_vectorstore(text_chunks)
142
+
143
+ # create conversation chain
144
+ st.session_state.conversation = get_conversation_chain(vectorstore)
145
  ####################################################################################################################
146
  def main():
147
  st.set_page_config(
 
170
  if st.button("Answer"):
171
  with st.spinner("Answering"):
172
  handle_userinput(user_question)
173
+ process()
174
  if st.button("CLEAR"):
175
  with st.spinner("CLEARING"):
176
  st.cache_data.clear()
177
+ process()
178
 
179
 
180
  with st.sidebar: