Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -179,7 +179,16 @@ max_iterations = 5
|
|
179 |
iterations = 0
|
180 |
|
181 |
def answer_question(user_question):
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
''' global iterations
|
184 |
iterations = 0
|
185 |
|
@@ -201,16 +210,7 @@ def answer_question(user_question):
|
|
201 |
# Print memory buffer for debugging
|
202 |
print("Memory Buffer11:", memory.load_memory_variables({}))
|
203 |
'''
|
204 |
-
|
205 |
-
response = agent_executor.invoke({"input": user_question})
|
206 |
-
if isinstance(response, dict):
|
207 |
-
response_text = response.get("output", "")
|
208 |
-
else:
|
209 |
-
response_text = response
|
210 |
-
response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()
|
211 |
-
|
212 |
-
return response_text
|
213 |
-
|
214 |
# Create the Gradio interface
|
215 |
iface = gr.Interface(
|
216 |
fn=answer_question,
|
|
|
179 |
iterations = 0
|
180 |
|
181 |
def answer_question(user_question):
|
182 |
+
# Format the response text
|
183 |
+
response = agent_executor.invoke({"input": user_question})
|
184 |
+
if isinstance(response, dict):
|
185 |
+
response_text = response.get("output", "")
|
186 |
+
else:
|
187 |
+
response_text = response
|
188 |
+
response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()
|
189 |
+
|
190 |
+
return response_text
|
191 |
+
|
192 |
''' global iterations
|
193 |
iterations = 0
|
194 |
|
|
|
210 |
# Print memory buffer for debugging
|
211 |
print("Memory Buffer11:", memory.load_memory_variables({}))
|
212 |
'''
|
213 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
# Create the Gradio interface
|
215 |
iface = gr.Interface(
|
216 |
fn=answer_question,
|