Update page_files/Upload_Data.py
Browse files
page_files/Upload_Data.py
CHANGED
|
@@ -119,7 +119,7 @@ def extract_images(pdf_path: str) -> list:
|
|
| 119 |
try:
|
| 120 |
with open(pdf_path, "rb") as f:
|
| 121 |
pdf_bytes = f.read()
|
| 122 |
-
|
| 123 |
pdf_bytes, verify_engines=["gemini"]
|
| 124 |
)
|
| 125 |
# Drop captions naming photos/micrographs/logos and crops the verifier
|
|
@@ -656,13 +656,13 @@ def render_plots_tab(pdf_path: str, paper_id: str):
|
|
| 656 |
d1, d2 = st.columns(2)
|
| 657 |
d1.download_button(
|
| 658 |
"⬇ Images + metadata (ZIP)",
|
| 659 |
-
data=
|
| 660 |
file_name=f"{paper_id}_plots.zip", mime="application/zip",
|
| 661 |
use_container_width=True, key="dl_plots_zip",
|
| 662 |
)
|
| 663 |
d2.download_button(
|
| 664 |
"⬇ Images only (ZIP)",
|
| 665 |
-
data=
|
| 666 |
file_name=f"{paper_id}_images.zip", mime="application/zip",
|
| 667 |
use_container_width=True, key="dl_images_zip",
|
| 668 |
)
|
|
|
|
| 119 |
try:
|
| 120 |
with open(pdf_path, "rb") as f:
|
| 121 |
pdf_bytes = f.read()
|
| 122 |
+
plot_results, coverage = Pdf_ImageExtraction.extract_and_verify_plots(
|
| 123 |
pdf_bytes, verify_engines=["gemini"]
|
| 124 |
)
|
| 125 |
# Drop captions naming photos/micrographs/logos and crops the verifier
|
|
|
|
| 656 |
d1, d2 = st.columns(2)
|
| 657 |
d1.download_button(
|
| 658 |
"⬇ Images + metadata (ZIP)",
|
| 659 |
+
data=Pdf_ImageExtraction.create_plot_zip(plot_results, include_json=True),
|
| 660 |
file_name=f"{paper_id}_plots.zip", mime="application/zip",
|
| 661 |
use_container_width=True, key="dl_plots_zip",
|
| 662 |
)
|
| 663 |
d2.download_button(
|
| 664 |
"⬇ Images only (ZIP)",
|
| 665 |
+
data=Pdf_ImageExtraction.create_plot_zip(plot_results, include_json=False),
|
| 666 |
file_name=f"{paper_id}_images.zip", mime="application/zip",
|
| 667 |
use_container_width=True, key="dl_images_zip",
|
| 668 |
)
|