kamau1 commited on
Commit
710fb48
·
verified ·
1 Parent(s): 115f014

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -118,7 +118,7 @@ def main():
118
  st.session_state.conversation = get_conversation_chain(vectorstore)
119
  st.info("done")
120
 
121
- #user_question = st.text_input("Get insights into your finances ...")
122
  # show user input
123
  if "messages" not in st.session_state:
124
  st.session_state.messages = []
@@ -131,15 +131,16 @@ def main():
131
  with st.chat_message("user"):
132
  st.markdown(user_question)
133
 
134
- #user_langd, Queryd = translate(user_question, 'eng_Latn')
135
  st.session_state.messages.append({"role": "user", "content": user_question})
136
  response = st.session_state.conversation({"question": user_question}) #Queryd
137
  st.session_state.chat_history = response["chat_history"]
138
 
139
- #output = translate(response['answer'], user_langd, 'eng_Latn')[1] # translated response
140
  with st.chat_message("assistant"):
141
- st.markdown(response['answer'])
142
- st.session_state.messages.append({"role": "assistant", "content": response})
 
143
 
144
  # Signature
145
  st.markdown(
 
118
  st.session_state.conversation = get_conversation_chain(vectorstore)
119
  st.info("done")
120
 
121
+ #user_question = st.text_input("chat with your pdf ...")
122
  # show user input
123
  if "messages" not in st.session_state:
124
  st.session_state.messages = []
 
131
  with st.chat_message("user"):
132
  st.markdown(user_question)
133
 
134
+ user_langd, Queryd = translate(user_question, 'eng_Latn')
135
  st.session_state.messages.append({"role": "user", "content": user_question})
136
  response = st.session_state.conversation({"question": user_question}) #Queryd
137
  st.session_state.chat_history = response["chat_history"]
138
 
139
+ output = translate(response['answer'], user_langd, 'eng_Latn')[1] # translated response
140
  with st.chat_message("assistant"):
141
+ #st.markdown(response['answer'])
142
+ st.markdown(output)
143
+ st.session_state.messages.append({"role": "assistant", "content": response['answer']})
144
 
145
  # Signature
146
  st.markdown(