innafomina commited on
Commit
b23dd30
·
1 Parent(s): dd7708e

fixed sleep issue

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -119,27 +119,26 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
119
  images = []
120
  #added limit for testing
121
  for req_num, item in enumerate(questions_data):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  if req_num % 2 == 0:
123
  time.sleep(30)
124
- else:
125
- task_id = item.get("task_id")
126
- question_text = item.get("question") + ' You can use wikipedia. Do not change original names or omit name parts.'
127
- file_name = item.get('file_name')
128
- if file_name:
129
- file_path = download_files(task_id, file_name)
130
- file_format = file_name.split('.')[-1]
131
- question_text = question_text + f"This question has an associated file at path: {file_path}. The file is in the {file_format} format"
132
- if not task_id or question_text is None:
133
- print(f"Skipping item with missing task_id or question: {item}")
134
- continue
135
- try:
136
- submitted_answer = agent(question_text)
137
- print(submitted_answer)
138
- answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
139
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
140
- except Exception as e:
141
- print(f"Error running agent on task {task_id}: {e}")
142
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
143
 
144
  if not answers_payload:
145
  print("Agent did not produce any answers to submit.")
 
119
  images = []
120
  #added limit for testing
121
  for req_num, item in enumerate(questions_data):
122
+ task_id = item.get("task_id")
123
+ question_text = item.get("question") + ' You can use wikipedia. Do not change original names or omit name parts.'
124
+ file_name = item.get('file_name')
125
+ if file_name:
126
+ file_path = download_files(task_id, file_name)
127
+ file_format = file_name.split('.')[-1]
128
+ question_text = question_text + f"This question has an associated file at path: {file_path}. The file is in the {file_format} format"
129
+ if not task_id or question_text is None:
130
+ print(f"Skipping item with missing task_id or question: {item}")
131
+ continue
132
+ try:
133
+ submitted_answer = agent(question_text)
134
+ print(submitted_answer)
135
+ answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
136
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
137
+ except Exception as e:
138
+ print(f"Error running agent on task {task_id}: {e}")
139
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
140
  if req_num % 2 == 0:
141
  time.sleep(30)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
  if not answers_payload:
144
  print("Agent did not produce any answers to submit.")