MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / _ui_header_logos_html

Function _ui_header_logos_html

demo/app.py:125–164  ·  view source on GitHub ↗

Return an HTML div with base64-embedded logos to avoid broken /file routes. Logos are fixed at top-right, slightly inset, with larger spacing.

()

Source from the content-addressed store, hash-verified

123 return found
124
125def _ui_header_logos_html():
126 """Return an HTML div with base64-embedded logos to avoid broken /file routes.
127 Logos are fixed at top-right, slightly inset, with larger spacing.
128 """
129 import base64
130 logos = _find_ui_header_logos(ROOT)
131 if not logos:
132 return ""
133 parts = []
134 for p in logos:
135 try:
136 b = p.read_bytes()
137 b64 = base64.b64encode(b).decode("utf-8")
138 mime = "image/png" if p.suffix.lower() == ".png" else "image/jpeg"
139 src = f"data:{mime};base64,{b64}"
140 name = p.name.lower()
141 href = None
142 if "camel" in name:
143 href = "https://www.camel-ai.org/"
144 elif "tvg" in name or "torr" in name:
145 href = "https://torrvision.com/index.html"
146 elif "waterloo" in name:
147 href = "https://uwaterloo.ca/"
148 img = f"<img src='{src}' alt='{p.stem}' style='height:44px;width:auto;object-fit:contain;display:block;cursor:pointer'>"
149 parts.append(f"<a href='{href}' target='_blank' rel='noopener'>{img}</a>" if href else img)
150 except Exception:
151 continue
152 if not parts:
153 return ""
154 # Fixed-position header bar at top-right; moved further left and larger spacing
155 imgs = "".join(parts)
156 return (
157 "<style>"
158 "#p2p-logo-bar{position:fixed;top:12px;right:140px;display:flex;gap:24px;"
159 "align-items:center;z-index:9999}"
160 "#p2p-logo-bar a{display:block;line-height:0}"
161 "@media (max-width: 768px){#p2p-logo-bar img{height:32px}}"
162 "</style>"
163 "<div id='p2p-logo-bar'>" + imgs + "</div>"
164 )
165
166def _default_conf_logo_path():
167 """Pick a default conference logo to preview.

Callers 1

app.pyFile · 0.85

Calls 1

_find_ui_header_logosFunction · 0.85

Tested by

no test coverage detected