srijanjoshi commited on
Commit
da41aef
·
verified ·
1 Parent(s): f2cbc44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -356,7 +356,7 @@ class GaiaAgent:
356
  if action_input != "none":
357
  try:
358
  state["search_result"] = await self.search_tool.run(action_input)
359
- if "name in state["question"].lower():
360
  names = re.findall(r'\b[A-Z][a-z]+(?:\s[A-Z][a-zA-Z]+)?\b', state["search_result"])
361
  state["search_result"] += f" Names: {', '.join(names[:5])}"
362
  elif "country code" in state["question"].lower():
@@ -376,14 +376,14 @@ class GaiaAgent:
376
 
377
  def audio_error_node(state: AgentState) -> AgentState:
378
  logging.warning(f"Audio task not supported: {state['task_id']}")
379
- state["answer"] = "ERROR: Audio transcription not supported."
380
  state["action"] = None
381
  state["messages"].append("Audio not supported.")
382
  return state
383
 
384
  def image_error_node(state: AgentState) -> AgentState:
385
  logging.warning(f"Image task not supported: {state['task_id']}")
386
- state["answer"] = "ERROR: Image processing not supported."
387
  state["action"] = None
388
  state["messages"].append("Image not supported.")
389
  return state
@@ -396,11 +396,11 @@ class GaiaAgent:
396
  if "sales" in state["question"].lower() and "food" in state["question"].lower():
397
  try:
398
  df = state["file_data"]
399
- logging.debug(f"Excel columns: {df.columns.tolist()]}")
400
  sales_col = next((col for col in df.columns if any(k in col.lower() for k in ["sale", "sales", "amount", "revenue"])), None)
401
  category_col = next((col for col in df.columns if any(k in col.lower() for k in ["category", "type", "item"])), None)
402
  if sales_col and category_col:
403
- food_sales = df[df["category"].str.lower().str.contains("drink", case=False, na=False) == False][sales_col].sum()
404
  state["answer"] = f"${food_sales:.2f}"
405
  else:
406
  logging.error("Invalid sales data: missing columns")
 
356
  if action_input != "none":
357
  try:
358
  state["search_result"] = await self.search_tool.run(action_input)
359
+ if "name" in state["question"].lower():
360
  names = re.findall(r'\b[A-Z][a-z]+(?:\s[A-Z][a-zA-Z]+)?\b', state["search_result"])
361
  state["search_result"] += f" Names: {', '.join(names[:5])}"
362
  elif "country code" in state["question"].lower():
 
376
 
377
  def audio_error_node(state: AgentState) -> AgentState:
378
  logging.warning(f"Audio task not supported: {state['task_id']}")
379
+ state["answer"] = "ERROR: Audio transcription not supported"
380
  state["action"] = None
381
  state["messages"].append("Audio not supported.")
382
  return state
383
 
384
  def image_error_node(state: AgentState) -> AgentState:
385
  logging.warning(f"Image task not supported: {state['task_id']}")
386
+ state["answer"] = "ERROR: Image processing not supported"
387
  state["action"] = None
388
  state["messages"].append("Image not supported.")
389
  return state
 
396
  if "sales" in state["question"].lower() and "food" in state["question"].lower():
397
  try:
398
  df = state["file_data"]
399
+ logging.debug(f"Excel columns: {df.columns.tolist()}")
400
  sales_col = next((col for col in df.columns if any(k in col.lower() for k in ["sale", "sales", "amount", "revenue"])), None)
401
  category_col = next((col for col in df.columns if any(k in col.lower() for k in ["category", "type", "item"])), None)
402
  if sales_col and category_col:
403
+ food_sales = df[df[category_col].str.lower().str.contains("drink", case=False, na=False) == False][sales_col].sum()
404
  state["answer"] = f"${food_sales:.2f}"
405
  else:
406
  logging.error("Invalid sales data: missing columns")