Update src/streamlit_app.py
Browse files- src/streamlit_app.py +8 -14
src/streamlit_app.py
CHANGED
|
@@ -539,20 +539,14 @@ if not st.session_state.is_processing_batch and len(st.session_state.batch_resul
|
|
| 539 |
st.warning(f"PDF {uploaded_file.name} has no pages.")
|
| 540 |
continue
|
| 541 |
except Exception as e:
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
pix = page.get_pixmap(dpi=200)
|
| 551 |
-
from PIL import Image
|
| 552 |
-
image = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
| 553 |
-
except Exception as e2:
|
| 554 |
-
st.warning(f"Fallback rendering (PyMuPDF) also failed for {uploaded_file.name}: {e2}")
|
| 555 |
-
continue
|
| 556 |
|
| 557 |
|
| 558 |
if image is None:
|
|
|
|
| 539 |
st.warning(f"PDF {uploaded_file.name} has no pages.")
|
| 540 |
continue
|
| 541 |
except Exception as e:
|
| 542 |
+
st.warning(f"Could not render PDF {uploaded_file.name}. Ensure 'pdf2image' and poppler are installed.")
|
| 543 |
+
continue
|
| 544 |
+
else:
|
| 545 |
+
try:
|
| 546 |
+
image = Image.open(BytesIO(uploaded_bytes)).convert("RGB")
|
| 547 |
+
except Exception as e:
|
| 548 |
+
st.warning(f"Failed to open {uploaded_file.name}.")
|
| 549 |
+
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
|
| 551 |
|
| 552 |
if image is None:
|