Update app.py
Browse files
app.py
CHANGED
|
@@ -19,8 +19,10 @@ def download_file(task_id, filename, save_dir="attachments"):
|
|
| 19 |
os.makedirs(save_dir, exist_ok=True)
|
| 20 |
url = f"https://agents-course-unit4-scoring.hf.space/files/{task_id}"
|
| 21 |
save_path = os.path.join(save_dir, filename)
|
|
|
|
| 22 |
try:
|
| 23 |
resp = requests.get(url, timeout=15)
|
|
|
|
| 24 |
resp.raise_for_status()
|
| 25 |
with open(save_path, "wb") as f:
|
| 26 |
f.write(resp.content)
|
|
@@ -154,6 +156,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 154 |
task_id = item.get("task_id")
|
| 155 |
question_text = item.get("question")
|
| 156 |
file_list = item.get("files", [])
|
|
|
|
| 157 |
|
| 158 |
local_files = []
|
| 159 |
for fname in file_list:
|
|
|
|
| 19 |
os.makedirs(save_dir, exist_ok=True)
|
| 20 |
url = f"https://agents-course-unit4-scoring.hf.space/files/{task_id}"
|
| 21 |
save_path = os.path.join(save_dir, filename)
|
| 22 |
+
print(f"[DEBUG] Try download: url={url} save_path={save_path}")
|
| 23 |
try:
|
| 24 |
resp = requests.get(url, timeout=15)
|
| 25 |
+
print(f"[DEBUG] HTTP {resp.status_code} for {url}")
|
| 26 |
resp.raise_for_status()
|
| 27 |
with open(save_path, "wb") as f:
|
| 28 |
f.write(resp.content)
|
|
|
|
| 156 |
task_id = item.get("task_id")
|
| 157 |
question_text = item.get("question")
|
| 158 |
file_list = item.get("files", [])
|
| 159 |
+
print(f"[DEBUG] Q{idx+1}/{len(questions_data)} | task_id={task_id} | files={file_list}")
|
| 160 |
|
| 161 |
local_files = []
|
| 162 |
for fname in file_list:
|