Spaces:
Sleeping
Sleeping
Pointf5ive commited on
Commit ·
0964303
1
Parent(s): e38e791
Fix profile dtype crash by stringifying manifest page_count
Browse files- smoke_signal_tab.py +2 -2
smoke_signal_tab.py
CHANGED
|
@@ -1238,7 +1238,7 @@ def ingest_pdfs(files, rights_class: str, notes: str, book_code_hint: str = "",
|
|
| 1238 |
"book_id": book_id,
|
| 1239 |
"filename": path.name,
|
| 1240 |
"sha256": file_hash,
|
| 1241 |
-
"page_count": page_count
|
| 1242 |
"rights_class": rights_class,
|
| 1243 |
"status": "pending",
|
| 1244 |
"acquisition_date": datetime.utcnow().date().isoformat(),
|
|
@@ -1389,7 +1389,7 @@ def run_profile(book_ids: Optional[list[str]] = None) -> tuple:
|
|
| 1389 |
json.dump(profile, f, indent=2)
|
| 1390 |
|
| 1391 |
df.loc[df["book_id"] == book_id, "status"] = "profiled"
|
| 1392 |
-
df.loc[df["book_id"] == book_id, "page_count"] = len(pages)
|
| 1393 |
log.append(log_line(f"✓ {book_id}: {len(pages)}pp — embed={routes['embedded_text']} ocr={routes['ocr']} hybrid={routes['hybrid']}"))
|
| 1394 |
|
| 1395 |
except Exception as e:
|
|
|
|
| 1238 |
"book_id": book_id,
|
| 1239 |
"filename": path.name,
|
| 1240 |
"sha256": file_hash,
|
| 1241 |
+
"page_count": str(page_count) if page_count else "",
|
| 1242 |
"rights_class": rights_class,
|
| 1243 |
"status": "pending",
|
| 1244 |
"acquisition_date": datetime.utcnow().date().isoformat(),
|
|
|
|
| 1389 |
json.dump(profile, f, indent=2)
|
| 1390 |
|
| 1391 |
df.loc[df["book_id"] == book_id, "status"] = "profiled"
|
| 1392 |
+
df.loc[df["book_id"] == book_id, "page_count"] = str(len(pages))
|
| 1393 |
log.append(log_line(f"✓ {book_id}: {len(pages)}pp — embed={routes['embedded_text']} ocr={routes['ocr']} hybrid={routes['hybrid']}"))
|
| 1394 |
|
| 1395 |
except Exception as e:
|