andreska commited on
Commit
7c62ad6
·
verified ·
1 Parent(s): 1a1a889

Try fix issue with rendering of streamed text and final text

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -43,8 +43,8 @@ st.markdown(
43
  )
44
 
45
  # Define the placeholder globally (outside columns)
46
- placeholder = st.empty()
47
- placeholder.markdown(f'<div class="scrollable-div"><p></p></div>', unsafe_allow_html=True)
48
 
49
  def handle_submit():
50
  user_input = st.session_state.user_input
@@ -63,9 +63,11 @@ def handle_submit():
63
  )
64
 
65
  answer = ""
 
 
66
  for chunk in response:
67
  answer += chunk['choices'][0]['delta']['content']
68
- placeholder.markdown(f'<div class="scrollable-div"><p>{answer}</p></div>', unsafe_allow_html=True)
69
 
70
  st.session_state.conversation = f"<p>{answer}</p>" + st.session_state.conversation
71
 
 
43
  )
44
 
45
  # Define the placeholder globally (outside columns)
46
+ #placeholder = st.empty()
47
+ #placeholder.markdown(f'<div class="scrollable-div"><p></p></div>', unsafe_allow_html=True)
48
 
49
  def handle_submit():
50
  user_input = st.session_state.user_input
 
63
  )
64
 
65
  answer = ""
66
+ response_placeholder = st.empty()
67
+
68
  for chunk in response:
69
  answer += chunk['choices'][0]['delta']['content']
70
+ response_placeholder.markdown(f'<div class="scrollable-div"><p>{answer}</p></div>', unsafe_allow_html=True)
71
 
72
  st.session_state.conversation = f"<p>{answer}</p>" + st.session_state.conversation
73