Update app.py
Browse files
app.py
CHANGED
|
@@ -107,6 +107,18 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 107 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 108 |
continue
|
| 109 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
submitted_answer = agent(question_text)
|
| 111 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 112 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
|
| 107 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 108 |
continue
|
| 109 |
try:
|
| 110 |
+
if file_name:
|
| 111 |
+
fetch_url = f"{api_url}/files/{task_id}"
|
| 112 |
+
print(f"Fetching file from {fetch_url} ")
|
| 113 |
+
try:
|
| 114 |
+
file_response = requests.get(fetch_url, timeout=15)
|
| 115 |
+
file_response.raise_for_status()
|
| 116 |
+
print("Finished fetching file.")
|
| 117 |
+
|
| 118 |
+
with open(file_name, "wb") as file:
|
| 119 |
+
file.write(file_response.content)
|
| 120 |
+
print("File is successfully written.")
|
| 121 |
+
|
| 122 |
submitted_answer = agent(question_text)
|
| 123 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 124 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|