Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
custom_css = """ | |
:root, [data-theme="light"] { | |
--f1-text: #111827; | |
--f1-subtle: #6b7280; | |
--f1-border: #e5e7eb; | |
--f1-bg: #ffffff; | |
--f1-bg-muted: #f9fafb; | |
/* Disable Gradio block chrome that was bleeding into the Examples switcher */ | |
--block-border-color: transparent !important; | |
--background-fill-primary: transparent !important; | |
} | |
/* Readable width everywhere */ | |
.f1-container { max-width: 800px; margin: 0 auto; padding: 0 16px; } | |
.markdown-text { font-size: 16px !important; max-width: 800px; margin: 0 auto; } | |
#what-is-tab { max-width: 800px; margin-left: auto; margin-right: auto; } | |
#f1-examples { max-width: 800px; margin: 0 auto; } | |
/* Body text */ | |
.f1-p, .f1-li { | |
line-height: 1.75; | |
color: #374151; | |
text-wrap: pretty; | |
overflow-wrap: break-word; | |
hyphens: auto; | |
} | |
/* Headings */ | |
.f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: var(--f1-text); text-align: center; margin-bottom: 1.25rem !important; } | |
.f1-h2 { | |
font-weight: 700; | |
border-bottom: 1px solid var(--f1-border); | |
padding-bottom: 0.45rem; | |
margin-top: 1.75rem; | |
margin-bottom: 0.9rem; | |
color: var(--f1-text); | |
font-size: 1.5rem; | |
line-height: 2rem; | |
} | |
/* Links */ | |
.f1-a { color: #2563eb; text-decoration: none; font-weight: 500; } | |
.f1-a:hover { text-decoration: underline; } | |
/* Captions, problem name */ | |
.f1-figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: #111827; text-align: center; } | |
.f1-problem-name { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-weight: 600; text-align: center; } | |
/* ===== Clean "table" (equal column widths per column; compact first two, flexible third) ===== */ | |
.f1-grid-wrap { text-align: center; margin: 10px auto 8px auto; } | |
.f1-grid-table { | |
display: inline-grid; /* center + shrink-to-fit */ | |
grid-template-columns: max-content max-content minmax(360px, auto); | |
border: 1px solid var(--f1-border); /* full border */ | |
background: var(--f1-bg); | |
border-radius: 8px; | |
overflow: hidden; | |
} | |
.f1-grid-row { display: contents; } /* rows share the same columns */ | |
.f1-grid-cell { | |
padding: 8px 12px; | |
text-align: left; | |
border-left: 1px solid var(--f1-border); | |
border-top: 1px solid var(--f1-border); | |
} | |
.f1-grid-cell:nth-child(3n+1) { border-left: none; } /* first column cells: no left border */ | |
.f1-grid-head .f1-grid-cell { | |
font-weight: 600; | |
text-align: center; | |
border-top: none; /* top edge of the grid */ | |
} | |
/* ===== Examples block ===== */ | |
#f1-examples { | |
background: var(--f1-bg-muted); /* #f9fafb */ | |
border: 1px solid var(--f1-border); | |
border-radius: 10px; | |
box-shadow: 0 1px 2px rgba(0,0,0,0.04); | |
margin-bottom: 12px; | |
} | |
.f1-tabs-body { padding-top: 12px; text-align: center; } | |
.f1-examples-chip { | |
display: inline-block; | |
background: #e5e7eb; /* slightly darker than #f9fafb */ | |
color: #111827; | |
padding: 6px 12px; | |
border-radius: 999px; | |
font-weight: 700; | |
} | |
/* Problem content: consistent background + padding + spacing above the tabs */ | |
#f1-examples .f1-problem-markdown .markdown { | |
background: var(--f1-bg-muted); | |
border: 1px solid var(--f1-border); | |
border-radius: 8px; | |
padding: 18px; | |
margin: 10px 14px 12px 14px; /* bottom margin creates padding before tabs */ | |
} | |
/* Pills (Radio) — hide bullets, light gray inactive, darker selected */ | |
#f1-example-radio { border-top: 1px solid var(--f1-border); padding: 8px 10px 10px 10px; margin: 0 8px 8px; } | |
#f1-example-radio input[type="radio"] { display: none; } | |
#f1-example-radio .wrap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; } | |
#f1-example-radio label { | |
border: 1px solid var(--f1-border); | |
border-radius: 999px; | |
padding: 6px 12px; | |
cursor: pointer; | |
background: #f3f4f6; /* inactive pills */ | |
} | |
#f1-example-radio input[type="radio"]:checked + span { | |
background: #e5e7eb; /* active pill */ | |
border-color: var(--f1-border); | |
border-radius: 999px; | |
padding: 6px 12px; | |
} | |
/* Gradio video styling (centered, rounded, subtle shadow) */ | |
.f1-video video { width: 100%; max-width: 42rem; display: block; margin: 0 auto; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); } | |
/* Leaderboard: cap width at 800px and center; keep your chain rule */ | |
#formulaone-leaderboard-tab-table { max-width: 800px; margin-left: auto; margin-right: auto; } | |
#formulaone-leaderboard-tab-table .column .row .column { min-width: 80% !important; } /* exact chain rule */ | |
#formulaone-leaderboard-tab-table .row, #formulaone-leaderboard-tab-table .column { width: 100% !important; max-width: 100% !important; } | |
#formulaone-leaderboard-tab-table [data-testid="dropdown"], #formulaone-leaderboard-tab-table input[type="text"] { width: 100% !important; } | |
/* Login button: force light */ | |
#hf-login-btn, #hf-login-btn button, button[data-testid="login-button"], [data-testid="login-button"] button, div[data-testid="login-button"] > button { | |
background: #ffffff !important; | |
color: #1f2937 !important; | |
border: 1px solid var(--f1-border) !important; | |
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04) !important; | |
} | |
#hf-login-btn:hover, #hf-login-btn button:hover, button[data-testid="login-button"]:hover, [data-testid="login-button"] button:hover, div[data-testid="login-button"] > button:hover { background: #f9fafb !important; } | |
""" | |
get_window_url_params = """ | |
function(url_params) { | |
const params = new URLSearchParams(window.location.search); | |
url_params = Object.fromEntries(params); | |
return url_params; | |
} | |
""" | |