Spaces:
Running
Running
Push Bot
commited on
Commit
·
d003291
1
Parent(s):
3bbe849
Preview fix: use iframe with served /file= path; add explicit PDF file output; normalize all yields to 5 outputs
Browse files
app.py
CHANGED
|
@@ -499,6 +499,19 @@ def _pdf_to_iframe_html(pdf_path: Path, width="100%", height="900px") -> str:
|
|
| 499 |
except Exception:
|
| 500 |
return ""
|
| 501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
def _compile_tex_to_pdf(tex_path: Path, logs):
|
| 503 |
"""Generic TeX compile helper for a .tex file. Returns Path to PDF or None."""
|
| 504 |
try:
|
|
@@ -1161,7 +1174,8 @@ def run_pipeline(arxiv_url, pdf_file, openai_key, logo_files, meeting_logo_file,
|
|
| 1161 |
try:
|
| 1162 |
pdf_path = _compile_poster_pdf(OUTPUT_DIR, logs)
|
| 1163 |
if pdf_path and pdf_path.exists():
|
| 1164 |
-
|
|
|
|
| 1165 |
compiled_pdf_file = str(pdf_path)
|
| 1166 |
logs.append("🖨️ PDF ready for preview in UI.")
|
| 1167 |
except Exception as e:
|
|
|
|
| 499 |
except Exception:
|
| 500 |
return ""
|
| 501 |
|
| 502 |
+
def _pdf_to_iframe_file(pdf_path: Path, width="100%", height="900px") -> str:
|
| 503 |
+
try:
|
| 504 |
+
from urllib.parse import quote
|
| 505 |
+
p = str(pdf_path)
|
| 506 |
+
src = f"/file={quote(p)}"
|
| 507 |
+
return (
|
| 508 |
+
f"<div style='border:1px solid #ddd;border-radius:8px;overflow:hidden'>"
|
| 509 |
+
f"<iframe src='{src}' width='{width}' height='{height}' style='border:0'></iframe>"
|
| 510 |
+
f"</div>"
|
| 511 |
+
)
|
| 512 |
+
except Exception:
|
| 513 |
+
return ""
|
| 514 |
+
|
| 515 |
def _compile_tex_to_pdf(tex_path: Path, logs):
|
| 516 |
"""Generic TeX compile helper for a .tex file. Returns Path to PDF or None."""
|
| 517 |
try:
|
|
|
|
| 1174 |
try:
|
| 1175 |
pdf_path = _compile_poster_pdf(OUTPUT_DIR, logs)
|
| 1176 |
if pdf_path and pdf_path.exists():
|
| 1177 |
+
# Prefer file-served iframe to avoid large data: URIs and browser blocks
|
| 1178 |
+
pdf_html = _pdf_to_iframe_file(pdf_path)
|
| 1179 |
compiled_pdf_file = str(pdf_path)
|
| 1180 |
logs.append("🖨️ PDF ready for preview in UI.")
|
| 1181 |
except Exception as e:
|