Update app.py
Browse filescheck if the file_name is not empty , if so add the location to the question text
app.py
CHANGED
|
@@ -164,6 +164,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 164 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 165 |
continue
|
| 166 |
try:
|
|
|
|
|
|
|
|
|
|
| 167 |
submitted_answer = agent(question_text)
|
| 168 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 169 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
|
| 164 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 165 |
continue
|
| 166 |
try:
|
| 167 |
+
# check if the file_name is not empty
|
| 168 |
+
if item.get("file_name"):
|
| 169 |
+
question_text = f"{question_text} Here is the file: https://agents-course-unit4-scoring.hf.space/files/{item.get('task_id')}"
|
| 170 |
submitted_answer = agent(question_text)
|
| 171 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 172 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|