ibyteohdear commited on
Commit
dbefd15
·
verified ·
1 Parent(s): 7ed535b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -152,24 +152,22 @@ agent.prompt_templates["system_prompt"] += """
152
  - You must use this answer in final_answer
153
  """
154
 
155
- def set_loading():
156
- return "⏳ Jerry is working on it..."
157
-
158
- def clear_loading():
159
- return ""
160
-
161
  def run_agent(query, nsfw_detection_input):
162
  global image_output
163
  image_output = None
164
-
 
 
165
  try:
166
  response = agent.run(
167
- query if query else "",
168
  additional_args={"nsfw_detection_input": nsfw_detection_input}
169
  )
170
- return image_output, str(response)
 
 
171
  except Exception as e:
172
- return None, f"Agent Error: {str(e)}"
173
 
174
  with gr.Blocks(title="Jerry AI Assistant") as demo:
175
  gr.Markdown("# 🤖 Jerry - Your AI Assistant")
 
152
  - You must use this answer in final_answer
153
  """
154
 
 
 
 
 
 
 
155
  def run_agent(query, nsfw_detection_input):
156
  global image_output
157
  image_output = None
158
+
159
+ yield None, "⏳ Jerry is thinking... please wait"
160
+
161
  try:
162
  response = agent.run(
163
+ query if query else "",
164
  additional_args={"nsfw_detection_input": nsfw_detection_input}
165
  )
166
+
167
+ yield image_output, str(response)
168
+
169
  except Exception as e:
170
+ yield None, f"Agent Error: {str(e)}"
171
 
172
  with gr.Blocks(title="Jerry AI Assistant") as demo:
173
  gr.Markdown("# 🤖 Jerry - Your AI Assistant")