Spaces:
Sleeping
Sleeping
Commit ·
daa297c
1
Parent(s): 571b306
feat: TRUS-588 - Add TrustModel logo and favicon to Gradio app
Browse filesBase64 encode logo SVG (white fill) for dark hero banner and inject
favicon via gr.Blocks head parameter to bypass Gradio file serving.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- app.py +16 -2
- favicon.svg +4 -0
- logo-full.svg +4 -0
app.py
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
API_URL = "https://api.trustmodel.ai/api/leaderboards/latest/"
|
| 5 |
LEADERBOARD_URL = "https://trustmodel.ai/leaderboard"
|
| 6 |
BADGE_BASE_URL = "https://trustmodel.ai/badge/model"
|
|
@@ -398,11 +405,18 @@ theme = gr.themes.Soft(
|
|
| 398 |
font=("Inter", "system-ui", "sans-serif"),
|
| 399 |
)
|
| 400 |
|
| 401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
# Header
|
| 404 |
gr.HTML(f"""<div class="header-banner">
|
| 405 |
-
<
|
|
|
|
| 406 |
<p>Look up TrustScores, compare AI models, and get badge embed code for your model card.</p>
|
| 407 |
<div class="stat-row">
|
| 408 |
<span class="stat-pill">Free — No Account Needed</span>
|
|
|
|
| 1 |
+
import base64
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
|
| 5 |
+
# Base64 encode logo for inline embedding (Gradio /file= route is unreliable)
|
| 6 |
+
# Read SVG and replace black fill with white for dark banner background
|
| 7 |
+
with open("logo-full.svg", "r") as _f:
|
| 8 |
+
_svg = _f.read().replace('fill="black"', 'fill="white"')
|
| 9 |
+
LOGO_B64 = base64.b64encode(_svg.encode()).decode()
|
| 10 |
+
|
| 11 |
API_URL = "https://api.trustmodel.ai/api/leaderboards/latest/"
|
| 12 |
LEADERBOARD_URL = "https://trustmodel.ai/leaderboard"
|
| 13 |
BADGE_BASE_URL = "https://trustmodel.ai/badge/model"
|
|
|
|
| 405 |
font=("Inter", "system-ui", "sans-serif"),
|
| 406 |
)
|
| 407 |
|
| 408 |
+
# Base64 encode favicon SVG for head injection
|
| 409 |
+
with open("favicon.svg", "r") as _f:
|
| 410 |
+
FAVICON_B64 = base64.b64encode(_f.read().encode()).decode()
|
| 411 |
+
|
| 412 |
+
FAVICON_HEAD = f'<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,{FAVICON_B64}">'
|
| 413 |
+
|
| 414 |
+
with gr.Blocks(title="TrustModel — AI Evaluation", css=CUSTOM_CSS, theme=theme, head=FAVICON_HEAD) as demo:
|
| 415 |
|
| 416 |
# Header
|
| 417 |
gr.HTML(f"""<div class="header-banner">
|
| 418 |
+
<img src="data:image/svg+xml;base64,{LOGO_B64}" alt="TrustModel" style="height:40px;margin:0 auto 14px;display:block;position:relative;">
|
| 419 |
+
<h1>AI Evaluation Space</h1>
|
| 420 |
<p>Look up TrustScores, compare AI models, and get badge embed code for your model card.</p>
|
| 421 |
<div class="stat-row">
|
| 422 |
<span class="stat-pill">Free — No Account Needed</span>
|
favicon.svg
ADDED
|
|
logo-full.svg
ADDED
|
|