Push Bot commited on
Commit
2c66a58
·
1 Parent(s): de7513c

UI header: add top-right logos (camel/tvg/waterloo) from assets; revert pipeline right-logo composition; keep emoji placement

Browse files
Files changed (2) hide show
  1. app.py +48 -0
  2. pipeline.py +0 -42
app.py CHANGED
@@ -72,6 +72,52 @@ def _write_logs(log_path: Path, logs):
72
  except Exception:
73
  pass
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  ## Removed sanitizer per request: do not mutate user-generated TeX
76
 
77
  def _on_rm_error(func, path, exc_info):
@@ -1544,6 +1590,8 @@ This work, developed in collaboration with [TVG@Oxford](https://torrvision.com/i
1544
 
1545
  🐪 The framework builds upon [CAMEL-ai](https://github.com/camel-ai/camel).
1546
  """)
 
 
1547
 
1548
  # -------- Input box --------
1549
  with gr.Row():
 
72
  except Exception:
73
  pass
74
 
75
+ def _find_ui_header_logos(root: Path):
76
+ """Find up to three logos for UI header in order: camel, tvg, waterloo.
77
+ Search common assets folders and return absolute paths.
78
+ """
79
+ cand_dirs = [
80
+ root / "assets",
81
+ root / "assets" / "logos",
82
+ root / "template" / "logos",
83
+ root / "Paper2Poster" / "assets",
84
+ root / "Paper2Poster" / "assets" / "logos",
85
+ ]
86
+ imgs = []
87
+ for d in cand_dirs:
88
+ try:
89
+ if d.exists():
90
+ for p in d.iterdir():
91
+ if p.is_file() and p.suffix.lower() in {".png", ".jpg", ".jpeg", ".webp"}:
92
+ imgs.append(p)
93
+ except Exception:
94
+ continue
95
+ def pick(sub):
96
+ for p in imgs:
97
+ if sub in p.name.lower():
98
+ return p
99
+ return None
100
+ order = []
101
+ for key in ("camel", "tvg", "waterloo"):
102
+ p = pick(key)
103
+ if p:
104
+ order.append(p)
105
+ return order
106
+
107
+ def _ui_header_logos_html():
108
+ from urllib.parse import quote
109
+ logos = _find_ui_header_logos(ROOT)
110
+ if not logos:
111
+ return ""
112
+ imgs = []
113
+ for p in logos:
114
+ src = f"/file={quote(str(p))}"
115
+ imgs.append(f"<img src='{src}' style='height:56px;width:auto;object-fit:contain'>")
116
+ return (
117
+ "<div style='display:flex;justify-content:flex-end;gap:12px;align-items:center;margin:8px 0'>"
118
+ + "".join(imgs) + "</div>"
119
+ )
120
+
121
  ## Removed sanitizer per request: do not mutate user-generated TeX
122
 
123
  def _on_rm_error(func, path, exc_info):
 
1590
 
1591
  🐪 The framework builds upon [CAMEL-ai](https://github.com/camel-ai/camel).
1592
  """)
1593
+ # Top-right logos (camel, tvg, waterloo) if available
1594
+ gr.HTML(_ui_header_logos_html())
1595
 
1596
  # -------- Input box --------
1597
  with gr.Row():
pipeline.py CHANGED
@@ -176,39 +176,6 @@ def _compose_logos_horizontally(logo_paths, out_path: Path, box_w=2000, box_h=47
176
  print(f" 🧩 Logos composed (width-locked) → {out_path.relative_to(ROOT_DIR)} "
177
  f"(n={n}, final_size={canvas_w}x{canvas_h})")
178
 
179
- def _find_right_logos_candidates(root_dir: Path):
180
- """Find candidate logos for right header in order: camel-ai, tvg, waterloo.
181
- Search common assets locations; match by filename substring (case-insensitive).
182
- """
183
- cand_dirs = [
184
- root_dir / "assets",
185
- root_dir / "assets" / "logos",
186
- root_dir / "Paper2Poster" / "assets",
187
- root_dir / "Paper2Poster" / "assets" / "logos",
188
- root_dir / "template" / "logos",
189
- ]
190
- imgs = []
191
- for d in cand_dirs:
192
- if d.exists():
193
- for p in d.iterdir():
194
- if p.is_file() and p.suffix.lower() in {".png", ".jpg", ".jpeg", ".webp", ".bmp"}:
195
- imgs.append(p)
196
-
197
- def pick(sub):
198
- for p in imgs:
199
- if sub in p.name.lower():
200
- return p
201
- return None
202
-
203
- picks = []
204
- for key in ("camel", "tvg", "waterloo"):
205
- p = pick(key)
206
- if p:
207
- picks.append(p)
208
- if not picks and imgs:
209
- picks = imgs[:3]
210
- return picks
211
-
212
 
213
 
214
 
@@ -389,15 +356,6 @@ if __name__ == '__main__':
389
  # 多图:拼接
390
  _compose_logos_horizontally(logo_files, left_logo_path, box_w=2000, box_h=476, gap=16)
391
 
392
- # Compose right header logos (camel-ai, tvg, waterloo) if available under assets
393
- try:
394
- right_candidates = _find_right_logos_candidates(ROOT_DIR)
395
- if right_candidates:
396
- right_logo_path = logos_out_dir / "right_logo.png"
397
- _compose_logos_horizontally(right_candidates, right_logo_path, box_w=2000, box_h=476, gap=24)
398
- except Exception as e:
399
- print(f"⚠️ Right-logo composition skipped: {e}")
400
-
401
  print("✅ Step 3 done.")
402
  except Exception as e:
403
  print(f"❌ Step 3 failed: {e}")
 
176
  print(f" 🧩 Logos composed (width-locked) → {out_path.relative_to(ROOT_DIR)} "
177
  f"(n={n}, final_size={canvas_w}x{canvas_h})")
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
 
181
 
 
356
  # 多图:拼接
357
  _compose_logos_horizontally(logo_files, left_logo_path, box_w=2000, box_h=476, gap=16)
358
 
 
 
 
 
 
 
 
 
 
359
  print("✅ Step 3 done.")
360
  except Exception as e:
361
  print(f"❌ Step 3 failed: {e}")