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; | |
/* Nuke Gradio chrome that interfered with colors */ | |
--block-border-color: transparent !important; | |
--background-fill-primary: transparent !important; | |
} | |
/* Width caps */ | |
.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; } | |
/* requested 710px */ | |
#f1-examples { max-width: 710px; margin: 0 auto; } | |
/* NEW: landing tab width + tier selector alignment */ | |
/* Landing tab width + tier selector alignment */ | |
#landing-accuracy-tab { max-width: 800px; margin-left: auto; margin-right: auto; } | |
/* Right-align the switcher row; transparent background & border */ | |
#f1-tier-select-row { | |
justify-content: flex-end; | |
margin-bottom: 6px; | |
background: white !important; | |
border: none !important; | |
} | |
/* Make the control look like "pills" and force RTL layout */ | |
#f1-tier-select { direction: rtl; } /* RTL direction (equivalent effect to dir="rtl") */ | |
#f1-tier-select .wrap { | |
display: inline-flex; | |
gap: 6px; | |
padding: 4px; | |
background: #ffffff; /* white background for the switcher itself */ | |
border: 1px solid var(--f1-border); | |
border-radius: 999px; | |
} | |
#f1-tier-select input[type="radio"] { display: none; } | |
#f1-tier-select label { | |
border: none; | |
border-radius: 999px; | |
padding: 6px 12px; | |
background: transparent; | |
cursor: pointer; | |
} | |
#f1-tier-select input[type="radio"]:checked + span { | |
background: #eef2ff; /* only selected pill is tinted */ | |
border-radius: 999px; | |
padding: 6px 12px; | |
box-shadow: 0 1px 2px rgba(0,0,0,0.04); | |
} | |
#f1-tier-select-row div { border: none; } | |
#f1-tier-select { background: white; } | |
#f1-accuracy-plot label { display: false; } | |
#learn-more-btn, #learn-more-btn button { | |
background: transparent !important; | |
border: none !important; | |
color: #2563eb !important; | |
font-weight: 700 !important; | |
font-size: 1.05rem !important; | |
padding: 0 !important; | |
box-shadow: none !important; | |
} | |
#learn-more-btn button:hover { text-decoration: underline !important; background: transparent !important; } | |
#landing-hero-row { | |
max-width: 800px; | |
margin-left: auto; | |
margin-right: auto; | |
margin-bottom: 8px; | |
align-items: center; | |
} | |
#landing-hero-left { padding-right: 8px; } | |
#landing-hero-right { display: flex; justify-content: flex-end; } | |
/* Blurb text */ | |
.f1-hero { margin: 0; font-size: 1.02rem; color: var(--f1-text); } | |
/* Learn More pill β compact */ | |
#learn-more-pill, | |
#learn-more-pill button { | |
width: auto !important; | |
min-width: 0 !important; | |
background: #2563eb !important; | |
color: #ffffff !important; | |
border: 0 !important; | |
border-radius: 999px !important; | |
padding: 6px 12px !important; | |
box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important; | |
font-weight: 700 !important; | |
font-size: 0.95rem !important; | |
white-space: nowrap !important; | |
} | |
#learn-more-pill button:hover { filter: brightness(0.95) !important; } | |
#landing-hero-left { min-width: 75%; } | |
/* 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 (centered + dark) */ | |
.f1-figcaption { margin-top: 4px; font-size: 0.875rem; color: #111827; text-align: center; } | |
.f1-figcaption-video { margin-top: 2px; } /* tighter under the video */ | |
/* Problem name β force center from first render; code bg color #f9fafb */ | |
#f1-examples .f1-problem-markdown .markdown p:first-child { text-align: center !important; margin: 0 0 8px 0; } | |
.f1-problem-markdown p code, | |
#f1-examples .f1-problem-markdown .markdown p:first-child code { | |
display: inline-block; background: #f9fafb !important; padding: 2px 8px; border-radius: 6px; margin-left: auto; margin-right: auto; | |
} | |
.f1-problem-markdown > * { margin-top: 7px; margin-bottom: 7px; line-height: 1.8; } | |
/* Problem body: padding + comfortable line-height inside Markdown + small space before 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 10px 14px; line-height: 1.8; } | |
#f1-examples .f1-problem-markdown .markdown p { margin: 0.35rem 0; } | |
/* Pills (Radio) β compact spacing at bottom */ | |
#f1-example-radio { border-top: 1px solid var(--f1-border); padding: 8px 10px 4px 10px; margin: 0 8px 2px; } | |
#f1-example-radio input[type="radio"] { display: none; } | |
#f1-example-radio .wrap { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; } | |
#f1-example-radio label { border: 1px solid var(--f1-border); border-radius: 999px; padding: 6px 10px; cursor: pointer; background: #f3f4f6; } | |
#f1-example-radio input[type="radio"]:checked + span { background: #e5e7eb; border-color: var(--f1-border); border-radius: 999px; padding: 6px 10px; } | |
/* Examples card chrome */ | |
#f1-examples { background: var(--f1-bg-muted); border: 1px solid var(--f1-border); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); margin-bottom: 12px; } | |
#f1-examples .form { background: transparent !important; } /* no bg on inner form container */ | |
.f1-tabs-body { padding-top: 12px; text-align: center; } | |
.f1-examples-chip { display: inline-block; background: #e5e7eb; color: #111827; padding: 6px 12px; border-radius: 999px; font-weight: 700; } | |
/* Figures via Gradio components (centered, rounded, shadow) */ | |
.f1-image img, .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); } | |
/* Categories "table" β equal width per column set; compact first two, flexible third */ | |
.f1-grid-wrap { text-align: center; margin: 10px auto 8px auto; } | |
.f1-grid-table { | |
display: inline-grid; | |
grid-template-columns: max-content 12ch minmax(360px, 1fr); /* 2nd col fixed width; 3rd grows */ | |
border: 1px solid var(--f1-border); | |
background: var(--f1-bg); | |
border-radius: 8px; | |
overflow: hidden; | |
} | |
.f1-grid-row { display: contents; } | |
.f1-grid-cell { padding: 8px 12px; text-align: left; border-left: 1px solid var(--f1-border); border-top: 1px solid var(--f1-border); white-space: normal; } | |
.f1-grid-cell:nth-child(3n+1) { border-left: none; } | |
.f1-grid-head .f1-grid-cell { font-weight: 600; text-align: center; border-top: none; } | |
#f1-login-box { width: 800px; margin: auto; } | |
/* 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; } | |
#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 and width cap */ | |
#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; | |
max-width: 800px !important; width: 100% !important; margin-left: auto !important; margin-right: auto !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; } | |
/* Checkbox styling for submission requirements */ | |
.markdown-text input[type="checkbox"] { | |
margin-right: 8px !important; | |
width: 16px !important; | |
height: 16px !important; | |
accent-color: #2563eb !important; | |
cursor: pointer !important; | |
} | |
.markdown-text label[data-testid="checkbox"] { | |
color: var(--f1-text) !important; | |
font-size: 14px !important; | |
line-height: 1.5 !important; | |
cursor: pointer !important; | |
display: flex !important; | |
align-items: flex-start !important; | |
margin-bottom: 8px !important; | |
} | |
/* Submit button styling when disabled */ | |
button[data-testid="button"]:disabled { | |
opacity: 0.5 !important; | |
cursor: not-allowed !important; | |
background: #f3f4f6 !important; | |
color: #9ca3af !important; | |
border-color: #d1d5db !important; | |
} | |
/* Required Agreements section | |
.markdown-text h3 { | |
color: var(--f1-text) !important; | |
font-weight: 600 !important; | |
margin: 20px 0 12px 0 !important; | |
font-size: 18px !important; | |
} | |
*/ | |
""" | |
get_window_url_params = """ | |
function(url_params) { | |
const params = new URLSearchParams(window.location.search); | |
url_params = Object.fromEntries(params); | |
return url_params; | |
} | |
""" | |