lozanopastor commited on
Commit
5001a34
·
verified ·
1 Parent(s): 37aebe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -76,12 +76,10 @@ def user_input(user_question):
76
  # Extract the thought process
77
  thought_process = ""
78
  if "<think>" in response['output_text'] and "</think>" in response['output_text']:
79
- thought_process_match = re.search(r"<think>(.*?)</think>", response['output_text'], re.DOTALL)
80
- if thought_process_match:
81
- thought_process = thought_process_match.group(1).strip()
82
 
83
  # Remove the thought process from the main response
84
- clean_response = re.sub(r"<think>.*?</think>", "", response['output_text']).strip()
85
 
86
  # Display the model's thought process in the expander
87
  with st.expander("Model Thought Process"):
@@ -128,3 +126,4 @@ def main():
128
 
129
  if __name__ == "__main__":
130
  main()
 
 
76
  # Extract the thought process
77
  thought_process = ""
78
  if "<think>" in response['output_text'] and "</think>" in response['output_text']:
79
+ thought_process = response['output_text'].split("<think>")[1].split("</think>")[0].strip()
 
 
80
 
81
  # Remove the thought process from the main response
82
+ clean_response = response['output_text'].replace(f"<think>{thought_process}</think>", "").strip()
83
 
84
  # Display the model's thought process in the expander
85
  with st.expander("Model Thought Process"):
 
126
 
127
  if __name__ == "__main__":
128
  main()
129
+