Nioi commited on
Commit
a60c396
·
1 Parent(s): ab0b2e4

answer checkfix

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. utils.py +2 -4
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  import requests
4
  import pandas as pd
5
  import agent
6
- from utils import check_reverse, reverse
7
 
8
  # (Keep Constants as is)
9
  # --- Constants ---
@@ -149,8 +149,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
149
  continue
150
  try:
151
  with open('system_prompt.txt') as f:
152
- submitted_answer = agent(f.read()+"\n\n"+question_text)
153
- answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
154
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
155
  except Exception as e:
156
  print(f"Error running agent on task {task_id}: {e}")
 
3
  import requests
4
  import pandas as pd
5
  import agent
6
+ from utils import check_reverse, reverse, check_fix_answer
7
 
8
  # (Keep Constants as is)
9
  # --- Constants ---
 
149
  continue
150
  try:
151
  with open('system_prompt.txt') as f:
152
+ submitted_answer = agent(f.read()+"\n\n"+f"TASK_ID:{task_id}\n"+question_text)
153
+ answers_payload.append({"task_id": task_id, "submitted_answer": check_fix_answer(submitted_answer)})
154
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
155
  except Exception as e:
156
  print(f"Error running agent on task {task_id}: {e}")
utils.py CHANGED
@@ -4,7 +4,5 @@ def check_reverse(question:str)->bool:
4
  def reverse(question:str)->str:
5
  return question[::-1]
6
 
7
- if __name__=='__main__':
8
- question = '.epA'
9
- if check_reverse(question):
10
- print(reverse(question))
 
4
  def reverse(question:str)->str:
5
  return question[::-1]
6
 
7
+ def check_fix_answer(answer:str)->str:
8
+ return answer.split('FINAL ANSWER:')[-1].strip()