Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -73,14 +73,22 @@ def user_input(user_question):
|
|
73 |
return_only_outputs=True
|
74 |
)
|
75 |
|
|
|
|
|
|
|
76 |
# Extract the thought process
|
77 |
thought_process = ""
|
78 |
if "<think>" in response['output_text'] and "</think>" in response['output_text']:
|
79 |
-
|
|
|
|
|
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"):
|
86 |
st.write(thought_process)
|
@@ -126,4 +134,3 @@ def main():
|
|
126 |
|
127 |
if __name__ == "__main__":
|
128 |
main()
|
129 |
-
|
|
|
73 |
return_only_outputs=True
|
74 |
)
|
75 |
|
76 |
+
# Debugging: Print the original response
|
77 |
+
print("Original Response:", response['output_text'])
|
78 |
+
|
79 |
# Extract the thought process
|
80 |
thought_process = ""
|
81 |
if "<think>" in response['output_text'] and "</think>" in response['output_text']:
|
82 |
+
thought_process_match = re.search(r"<think>(.*?)</think>", response['output_text'], re.DOTALL)
|
83 |
+
if thought_process_match:
|
84 |
+
thought_process = thought_process_match.group(1).strip()
|
85 |
|
86 |
# Remove the thought process from the main response
|
87 |
clean_response = response['output_text'].replace(f"<think>{thought_process}</think>", "").strip()
|
88 |
|
89 |
+
# Debugging: Print the cleaned response
|
90 |
+
print("Cleaned Response:", clean_response)
|
91 |
+
|
92 |
# Display the model's thought process in the expander
|
93 |
with st.expander("Model Thought Process"):
|
94 |
st.write(thought_process)
|
|
|
134 |
|
135 |
if __name__ == "__main__":
|
136 |
main()
|
|