Spaces:
Runtime error
Runtime error
lakshmivairamani
commited on
Commit
•
1236a43
1
Parent(s):
40b6522
Update app.py
Browse files
app.py
CHANGED
@@ -178,14 +178,14 @@ agent_executor = AgentExecutor(agent=agent, tools=tools, memory= memory, verbose
|
|
178 |
max_iterations = 5
|
179 |
iterations = 0
|
180 |
|
181 |
-
def answer_question(user_question
|
182 |
"""
|
183 |
This function takes a user question as input and generates a response using an agent executor.
|
184 |
It iterates until a valid response is generated or the maximum number of iterations is reached.
|
185 |
|
186 |
Parameters:
|
187 |
- user_question (str): The question asked by the user.
|
188 |
-
|
189 |
|
190 |
Returns:
|
191 |
- str: The generated response or an error message if no valid response is generated within the iteration limit.
|
@@ -215,8 +215,7 @@ def answer_question(user_question, city="United Arab Emirates"):
|
|
215 |
response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()
|
216 |
|
217 |
return response_text
|
218 |
-
|
219 |
-
css_code = ".gradio-container {background: url(https://picsum.photos/seed/picsum/200/300);}"
|
220 |
# Create the Gradio interface
|
221 |
iface = gr.Interface(
|
222 |
fn=answer_question,
|
@@ -224,7 +223,7 @@ iface = gr.Interface(
|
|
224 |
outputs="text",
|
225 |
title="Chat with your data",
|
226 |
description="Ask a question about the database or API or a document and get a response in natural language.",
|
227 |
-
|
228 |
)
|
229 |
|
230 |
# Launch the Gradio interface
|
|
|
178 |
max_iterations = 5
|
179 |
iterations = 0
|
180 |
|
181 |
+
def answer_question(user_question):
|
182 |
"""
|
183 |
This function takes a user question as input and generates a response using an agent executor.
|
184 |
It iterates until a valid response is generated or the maximum number of iterations is reached.
|
185 |
|
186 |
Parameters:
|
187 |
- user_question (str): The question asked by the user.
|
188 |
+
|
189 |
|
190 |
Returns:
|
191 |
- str: The generated response or an error message if no valid response is generated within the iteration limit.
|
|
|
215 |
response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()
|
216 |
|
217 |
return response_text
|
218 |
+
|
|
|
219 |
# Create the Gradio interface
|
220 |
iface = gr.Interface(
|
221 |
fn=answer_question,
|
|
|
223 |
outputs="text",
|
224 |
title="Chat with your data",
|
225 |
description="Ask a question about the database or API or a document and get a response in natural language.",
|
226 |
+
|
227 |
)
|
228 |
|
229 |
# Launch the Gradio interface
|