Spaces:
Running
Running
CodexCLI Bot
commited on
Commit
·
e2098ef
1
Parent(s):
b4f9679
UI: fix outputs + preview image; emoji before CAMEL-ai; shrink logs; hide debug controls; add header logos and use template/logos with real images; tolerant XeLaTeX compile + image preview
Browse files- .gitignore +0 -2
- Paper2Poster/assets/camel_logo.png +3 -0
- Paper2Poster/assets/tvg_logo.png +3 -0
- Paper2Poster/assets/waterloo_uni_logo.png +3 -0
- app.py +60 -42
.gitignore
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
input/
|
| 2 |
output/
|
| 3 |
runs
|
| 4 |
-
Paper2Poster/assets/
|
| 5 |
Paper2Video/assets/
|
| 6 |
posterbuilder/latex_proj/figures/
|
| 7 |
-
*.png
|
| 8 |
*.pdf
|
| 9 |
*.jpg
|
| 10 |
*.wav
|
|
|
|
| 1 |
input/
|
| 2 |
output/
|
| 3 |
runs
|
|
|
|
| 4 |
Paper2Video/assets/
|
| 5 |
posterbuilder/latex_proj/figures/
|
|
|
|
| 6 |
*.pdf
|
| 7 |
*.jpg
|
| 8 |
*.wav
|
Paper2Poster/assets/camel_logo.png
ADDED
|
Git LFS Details
|
Paper2Poster/assets/tvg_logo.png
ADDED
|
Git LFS Details
|
Paper2Poster/assets/waterloo_uni_logo.png
ADDED
|
Git LFS Details
|
app.py
CHANGED
|
@@ -73,55 +73,73 @@ def _write_logs(log_path: Path, logs):
|
|
| 73 |
pass
|
| 74 |
|
| 75 |
def _find_ui_header_logos(root: Path):
|
| 76 |
-
"""
|
| 77 |
-
|
| 78 |
"""
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
def _ui_header_logos_html():
|
| 113 |
-
|
|
|
|
| 114 |
logos = _find_ui_header_logos(ROOT)
|
| 115 |
if not logos:
|
| 116 |
return ""
|
| 117 |
-
|
| 118 |
for p in logos:
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
## Removed sanitizer per request: do not mutate user-generated TeX
|
| 127 |
|
|
|
|
| 73 |
pass
|
| 74 |
|
| 75 |
def _find_ui_header_logos(root: Path):
|
| 76 |
+
"""Return list of Paths for UI header logos in order camel → tvg → waterloo.
|
| 77 |
+
Prefer template/logos; fallback to assets folders; if none match, return up to 3 images.
|
| 78 |
"""
|
| 79 |
+
preferred = root / "template" / "logos"
|
| 80 |
+
names = ["camel", "tvg", "waterloo"]
|
| 81 |
+
found = []
|
| 82 |
+
# Try preferred dir first with explicit names
|
| 83 |
+
try:
|
| 84 |
+
if preferred.exists():
|
| 85 |
+
allp = list(preferred.iterdir())
|
| 86 |
+
for key in names:
|
| 87 |
+
for p in allp:
|
| 88 |
+
if p.is_file() and p.suffix.lower() in {".png", ".jpg", ".jpeg", ".webp"} and key in p.name.lower():
|
| 89 |
+
found.append(p)
|
| 90 |
+
break
|
| 91 |
+
except Exception:
|
| 92 |
+
pass
|
| 93 |
+
# If not all found, search broader locations
|
| 94 |
+
if len(found) < 3:
|
| 95 |
+
cand_dirs = [
|
| 96 |
+
root / "assets",
|
| 97 |
+
root / "assets" / "logos",
|
| 98 |
+
root / "Paper2Poster" / "assets",
|
| 99 |
+
root / "Paper2Poster" / "assets" / "logos",
|
| 100 |
+
root / "paper2poster" / "assets",
|
| 101 |
+
root / "paper2poster" / "assets" / "logos",
|
| 102 |
+
]
|
| 103 |
+
imgs = []
|
| 104 |
+
for d in cand_dirs:
|
| 105 |
+
try:
|
| 106 |
+
if d.exists():
|
| 107 |
+
for p in d.iterdir():
|
| 108 |
+
if p.is_file() and p.suffix.lower() in {".png", ".jpg", ".jpeg", ".webp"}:
|
| 109 |
+
imgs.append(p)
|
| 110 |
+
except Exception:
|
| 111 |
+
continue
|
| 112 |
+
for key in names:
|
| 113 |
+
if any(key in str(fp).lower() for fp in found):
|
| 114 |
+
continue
|
| 115 |
+
for p in imgs:
|
| 116 |
+
if key in p.name.lower():
|
| 117 |
+
found.append(p)
|
| 118 |
+
break
|
| 119 |
+
# Fallback: fill up to 3
|
| 120 |
+
if not found and imgs:
|
| 121 |
+
found = imgs[:3]
|
| 122 |
+
return found
|
| 123 |
|
| 124 |
def _ui_header_logos_html():
|
| 125 |
+
"""Return an HTML div with base64-embedded logos to avoid broken /file routes."""
|
| 126 |
+
import base64
|
| 127 |
logos = _find_ui_header_logos(ROOT)
|
| 128 |
if not logos:
|
| 129 |
return ""
|
| 130 |
+
parts = []
|
| 131 |
for p in logos:
|
| 132 |
+
try:
|
| 133 |
+
b = p.read_bytes()
|
| 134 |
+
b64 = base64.b64encode(b).decode("utf-8")
|
| 135 |
+
mime = "image/png" if p.suffix.lower() == ".png" else "image/jpeg"
|
| 136 |
+
src = f"data:{mime};base64,{b64}"
|
| 137 |
+
parts.append(f"<img src='{src}' style='height:56px;width:auto;object-fit:contain'>")
|
| 138 |
+
except Exception:
|
| 139 |
+
continue
|
| 140 |
+
if not parts:
|
| 141 |
+
return ""
|
| 142 |
+
return "<div style='display:flex;justify-content:flex-end;gap:12px;align-items:center;margin:8px 0'>" + "".join(parts) + "</div>"
|
| 143 |
|
| 144 |
## Removed sanitizer per request: do not mutate user-generated TeX
|
| 145 |
|