Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
0c2f97b
1
Parent(s):
44bfe64
fix
Browse files
app.py
CHANGED
@@ -76,10 +76,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
76 |
continue
|
77 |
try:
|
78 |
file_name = item.get("file_name")
|
79 |
-
|
80 |
-
#if not file_name and "bird" not in question_text:
|
81 |
-
# continue
|
82 |
question_text_for_agent = question_text
|
|
|
83 |
if file_name:
|
84 |
print(f"The following question has attatched file: {question_text[:50]}")
|
85 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
@@ -91,9 +90,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
91 |
file_path = os.path.join(BASE_DIR, 'files', file_name)
|
92 |
plain_txt_file = get_text_file_contents(file_path)
|
93 |
question_text_for_agent += f'. The attatchement has the following content: {plain_txt_file}'
|
|
|
94 |
submitted_answer = agent(question_text_for_agent)
|
95 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
96 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
97 |
except Exception as e:
|
98 |
print(f"Error running agent on task {task_id}: {e}")
|
99 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
76 |
continue
|
77 |
try:
|
78 |
file_name = item.get("file_name")
|
79 |
+
|
|
|
|
|
80 |
question_text_for_agent = question_text
|
81 |
+
|
82 |
if file_name:
|
83 |
print(f"The following question has attatched file: {question_text[:50]}")
|
84 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
90 |
file_path = os.path.join(BASE_DIR, 'files', file_name)
|
91 |
plain_txt_file = get_text_file_contents(file_path)
|
92 |
question_text_for_agent += f'. The attatchement has the following content: {plain_txt_file}'
|
93 |
+
|
94 |
submitted_answer = agent(question_text_for_agent)
|
95 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
96 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
97 |
+
|
98 |
except Exception as e:
|
99 |
print(f"Error running agent on task {task_id}: {e}")
|
100 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|