Skip to content

Commit b81681d

Browse files
fix: handle failure in bulk process
1 parent 1c3406d commit b81681d

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

dome_copilot/bulk_process.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
continue
3939

4040
# Otherwise generate
41-
result = client.predict(
42-
pdf_input=[handle_file(pdf_path) for pdf_path in pdf_paths],
43-
api_name="/generate_dome",
44-
)
45-
46-
# Rename the JSON file download by the Gradio client
47-
tmp_path = result[-1]
48-
Path(tmp_path).rename(json_path)
49-
print(f"[{i}/{len(subfolders)}] 🟢 Generated {subfolder.name} ")
41+
try:
42+
result = client.predict(
43+
pdf_input=[handle_file(pdf_path) for pdf_path in pdf_paths],
44+
api_name="/generate_dome",
45+
)
46+
47+
# Rename the JSON file download by the Gradio client
48+
tmp_path = result[-1]
49+
Path(tmp_path).rename(json_path)
50+
print(f"[{i}/{len(subfolders)}] 🟢 Generated {subfolder.name} ")
51+
except Exception:
52+
print(f"[{i}/{len(subfolders)}] 🔴 Failed to generate {subfolder.name} ")

0 commit comments

Comments
 (0)