the-confused-coder commited on
Commit
154634b
1 Parent(s): 627912d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -25,13 +25,18 @@ submit_button = st.button("Submit")
25
  if submit_button and usr_text:
26
  response = llm_gemini.invoke(usr_text)
27
  st.subheader("Answer:")
28
- st.write(response.content)
29
  st.session_state.chat_history.append(f'User: {usr_text} \nAI: {response.content}')
30
 
31
  # for displaying chat history
32
  chat_history_text = "\n\n".join(st.session_state.chat_history)
33
- st.text_area("**Chat History**", value=chat_history_text, height=300)
 
34
  # button for clearing chat history
35
  clr_btn = st.button("Clear Chat History")
36
  if clr_btn:
37
  st.session_state['chat_history']=[]
 
 
 
 
 
25
  if submit_button and usr_text:
26
  response = llm_gemini.invoke(usr_text)
27
  st.subheader("Answer:")
28
+ st.write(response.content)
29
  st.session_state.chat_history.append(f'User: {usr_text} \nAI: {response.content}')
30
 
31
  # for displaying chat history
32
  chat_history_text = "\n\n".join(st.session_state.chat_history)
33
+ history_container = st.empty()
34
+ history_container.text_area("**Chat History**", value=chat_history_text, height=300)
35
  # button for clearing chat history
36
  clr_btn = st.button("Clear Chat History")
37
  if clr_btn:
38
  st.session_state['chat_history']=[]
39
+ chat_history_text = "\n\n".join(st.session_state.chat_history)
40
+ history_container.text_area("**Chat History**", value=chat_history_text, height=300)
41
+
42
+