ali121300 commited on
Commit
7e3de88
1 Parent(s): 0315b44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -66,13 +66,15 @@ def handle_userinput(user_question:str):
66
 
67
  for i, message in enumerate(st.session_state.chat_history):
68
  if i % 2 == 0:
69
- #st.write("سوال کاربر: " + message.content)
 
 
 
70
  else:
71
- st.write("پاسخ ربات: ")
72
  text1=message.content
73
  translator = GoogleTranslator(source='english', target='persian')
74
  result = translator.translate(text1)
75
- st.write(result)
76
 
77
  #############################################################################################################
78
 
@@ -95,9 +97,9 @@ def main():
95
 
96
 
97
  st.header("Chat Bot PDFs :books:")
98
- user_question = st.text_input("Ask a question about your documents:")
99
  translator = GoogleTranslator(source='persian', target='english')
100
- user_question = translator.translate(user_question)
101
  if st.button("Answer"):
102
  with st.spinner("Answering"):
103
  handle_userinput(user_question)
@@ -127,4 +129,4 @@ def main():
127
 
128
  if __name__ == "__main__":
129
  main()
130
-
 
66
 
67
  for i, message in enumerate(st.session_state.chat_history):
68
  if i % 2 == 0:
69
+ text2=message.content
70
+ translator = GoogleTranslator(source='english', target='persian')
71
+ result = translator.translate(text2)
72
+ st.write("سوال کاربر: "+result)
73
  else:
 
74
  text1=message.content
75
  translator = GoogleTranslator(source='english', target='persian')
76
  result = translator.translate(text1)
77
+ st.write("پاسخ ربات: "+result)
78
 
79
  #############################################################################################################
80
 
 
97
 
98
 
99
  st.header("Chat Bot PDFs :books:")
100
+ user_question1 = st.text_input("Ask a question about your documents:")
101
  translator = GoogleTranslator(source='persian', target='english')
102
+ user_question = translator.translate(user_question1)
103
  if st.button("Answer"):
104
  with st.spinner("Answering"):
105
  handle_userinput(user_question)
 
129
 
130
  if __name__ == "__main__":
131
  main()
132
+