Commit d3b2981
authored
fix: typeerror when using chipper (#311)
This PR resolves #310
- chipper, or any page layout extracted with an element extraction model
do not have key attributes like `image_metadata` populated
- this leads to `None` values for image width and height, which lead to
the bug
- this fix prevents the function early return after chipper finds the
elements
- it continues the logic to allow other key attributes of the page to be
filled
- a bonus from this fix is we remove the image data from the page (which
is not needed downstream) for chipper generated pages
## Test
A unit test is modified to test all the routes, including using an
element extraction model, for page layout
Additionally grab this attached pdf and when running partition using
chipper the main branch would lead to type error but this fix would run
without error.
[005-CISA-AA22-076-Strengthening-Cybersecurity-p1-p4.pdf](https://github.com/Unstructured-IO/unstructured-inference/files/13731533/005-CISA-AA22-076-Strengthening-Cybersecurity-p1-p4.pdf)1 parent 8b33f14 commit d3b2981
File tree
4 files changed
+18
-6
lines changed- test_unstructured_inference/inference
- unstructured_inference
- inference
4 files changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
271 | 274 | | |
272 | 275 | | |
273 | 276 | | |
| 277 | + | |
274 | 278 | | |
275 | | - | |
| 279 | + | |
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
279 | 283 | | |
| 284 | + | |
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
| |||
285 | 290 | | |
286 | 291 | | |
287 | 292 | | |
288 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
289 | 297 | | |
290 | 298 | | |
291 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | | - | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
0 commit comments