Wajahat698 commited on
Commit
9ed36df
·
verified ·
1 Parent(s): a03e85f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -491,19 +491,22 @@ if prompt :
491
  "chat_history": st.session_state.chat_history
492
  })
493
  full_response = output["output"]
494
- st.write(full_response, unsafe_allow_html=True)
 
 
 
495
 
496
 
497
  # Display the response
498
 
499
- #st.write(full_response)
500
  follow_up_output = agent_executor.invoke({
501
  "input": f"Extract 1-2 follow-up questions from the following text: {full_response}",
502
  "chat_history": st.session_state.chat_history
503
  })
504
  follow_up_questions = follow_up_output["output"]
505
  if follow_up_questions:
506
- st.write(f"Follow-up questions:\n{follow_up_questions}")
507
 
508
 
509
  except Exception as e:
 
491
  "chat_history": st.session_state.chat_history
492
  })
493
  full_response = output["output"]
494
+
495
+
496
+ full_response = re.sub(r'\s+', ' ', full_response).strip()
497
+
498
 
499
 
500
  # Display the response
501
 
502
+ st.write(full_response)
503
  follow_up_output = agent_executor.invoke({
504
  "input": f"Extract 1-2 follow-up questions from the following text: {full_response}",
505
  "chat_history": st.session_state.chat_history
506
  })
507
  follow_up_questions = follow_up_output["output"]
508
  if follow_up_questions:
509
+ st.markdown(f"Follow-up questions:\n{follow_up_questions} \n")
510
 
511
 
512
  except Exception as e: