| import gradio as gr |
|
|
| def get_theme(): |
| """Returns a custom Gradio theme with Apple-inspired design.""" |
| theme = gr.themes.Base( |
| primary_hue="neutral", |
| secondary_hue="neutral", |
| neutral_hue="neutral", |
| spacing_size="lg", |
| radius_size="lg", |
| text_size="md", |
| font=[gr.themes.GoogleFont("Inter"), "system-ui", "-apple-system", "BlinkMacSystemFont", "sans-serif"], |
| font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "ui-monospace", "monospace"], |
| ).set( |
| |
| body_background_fill="*neutral_50", |
| body_background_fill_dark="*neutral_950", |
| body_text_color="*neutral_900", |
| body_text_color_dark="*neutral_100", |
|
|
| |
| block_background_fill="white", |
| block_background_fill_dark="*neutral_900", |
| block_border_width="0px", |
| block_shadow="0 1px 3px 0 rgb(0 0 0 / 0.05)", |
| block_shadow_dark="0 1px 3px 0 rgb(0 0 0 / 0.3)", |
| block_label_background_fill="transparent", |
| block_label_background_fill_dark="transparent", |
| block_label_text_color="*neutral_600", |
| block_label_text_color_dark="*neutral_400", |
| block_title_text_color="*neutral_900", |
| block_title_text_color_dark="*neutral_100", |
|
|
| |
| input_background_fill="*neutral_100", |
| input_background_fill_dark="*neutral_800", |
| input_border_color="*neutral_200", |
| input_border_color_dark="*neutral_700", |
| input_border_color_focus="*neutral_400", |
| input_border_color_focus_dark="*neutral_500", |
| input_placeholder_color="*neutral_400", |
| input_placeholder_color_dark="*neutral_500", |
|
|
| |
| button_primary_background_fill="*neutral_900", |
| button_primary_background_fill_dark="white", |
| button_primary_background_fill_hover="*neutral_800", |
| button_primary_background_fill_hover_dark="*neutral_200", |
| button_primary_text_color="white", |
| button_primary_text_color_dark="*neutral_900", |
| button_primary_border_color="transparent", |
| button_primary_border_color_dark="transparent", |
|
|
| |
| button_secondary_background_fill="transparent", |
| button_secondary_background_fill_dark="transparent", |
| button_secondary_background_fill_hover="*neutral_100", |
| button_secondary_background_fill_hover_dark="*neutral_800", |
| button_secondary_text_color="*neutral_700", |
| button_secondary_text_color_dark="*neutral_300", |
| button_secondary_border_color="*neutral_300", |
| button_secondary_border_color_dark="*neutral_700", |
|
|
| |
| border_color_primary="*neutral_200", |
| border_color_primary_dark="*neutral_800", |
|
|
| |
| background_fill_secondary="*neutral_100", |
| background_fill_secondary_dark="*neutral_800", |
| ) |
| return theme |
|
|
| css = """ |
| /* Apple-inspired CSS with full dark mode support */ |
| /* Note: Inter font is loaded via Gradio theme settings */ |
| |
| /* CSS Variables for theming */ |
| :root { |
| --bg-primary: #ffffff; |
| --bg-secondary: #f5f5f7; |
| --bg-tertiary: #fafafa; |
| --bg-card: #ffffff; |
| --bg-card-hover: #fafafa; |
| --bg-glass: rgba(255, 255, 255, 0.72); |
| |
| --text-primary: #1d1d1f; |
| --text-secondary: #6e6e73; |
| --text-tertiary: #86868b; |
| |
| --border-color: rgba(0, 0, 0, 0.08); |
| --border-color-strong: rgba(0, 0, 0, 0.12); |
| |
| --accent-blue: #0071e3; |
| --accent-blue-hover: #0077ed; |
| --accent-green: #30d158; |
| --accent-orange: #ff9f0a; |
| |
| --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04); |
| --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08); |
| --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12); |
| --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06); |
| --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.12); |
| |
| --radius-sm: 8px; |
| --radius-md: 12px; |
| --radius-lg: 16px; |
| --radius-xl: 20px; |
| --radius-full: 9999px; |
| |
| --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1); |
| --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1); |
| --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1); |
| } |
| |
| /* Dark mode variables */ |
| .dark, [data-theme="dark"] { |
| --bg-primary: #000000; |
| --bg-secondary: #1c1c1e; |
| --bg-tertiary: #2c2c2e; |
| --bg-card: #1c1c1e; |
| --bg-card-hover: #2c2c2e; |
| --bg-glass: rgba(28, 28, 30, 0.72); |
| |
| --text-primary: #f5f5f7; |
| --text-secondary: #a1a1a6; |
| --text-tertiary: #6e6e73; |
| |
| --border-color: rgba(255, 255, 255, 0.08); |
| --border-color-strong: rgba(255, 255, 255, 0.12); |
| |
| --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2); |
| --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3); |
| --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4); |
| --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(255, 255, 255, 0.05); |
| --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.4); |
| } |
| |
| /* Also support system preference */ |
| @media (prefers-color-scheme: dark) { |
| :root:not(.light) { |
| --bg-primary: #000000; |
| --bg-secondary: #1c1c1e; |
| --bg-tertiary: #2c2c2e; |
| --bg-card: #1c1c1e; |
| --bg-card-hover: #2c2c2e; |
| --bg-glass: rgba(28, 28, 30, 0.72); |
| |
| --text-primary: #f5f5f7; |
| --text-secondary: #a1a1a6; |
| --text-tertiary: #6e6e73; |
| |
| --border-color: rgba(255, 255, 255, 0.08); |
| --border-color-strong: rgba(255, 255, 255, 0.12); |
| |
| --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2); |
| --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3); |
| --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4); |
| --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(255, 255, 255, 0.05); |
| --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.4); |
| } |
| } |
| |
| /* Base styles */ |
| * { |
| box-sizing: border-box; |
| } |
| |
| body, .gradio-container { |
| font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif !important; |
| background: var(--bg-secondary) !important; |
| color: var(--text-primary) !important; |
| -webkit-font-smoothing: antialiased; |
| -moz-osx-font-smoothing: grayscale; |
| } |
| |
| /* Main container */ |
| .container { |
| max-width: 1200px; |
| margin: 0 auto; |
| padding: 2rem 1.5rem; |
| } |
| |
| /* Hero section */ |
| .hero-section { |
| text-align: center; |
| padding: 3rem 1rem 2rem; |
| margin-bottom: 1rem; |
| } |
| |
| .hero-title { |
| font-size: 2.75rem !important; |
| font-weight: 700 !important; |
| color: var(--text-primary) !important; |
| letter-spacing: -0.025em !important; |
| line-height: 1.1 !important; |
| margin: 0 0 0.75rem 0 !important; |
| background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%); |
| -webkit-background-clip: text; |
| background-clip: text; |
| } |
| |
| .hero-subtitle { |
| font-size: 1.125rem !important; |
| color: var(--text-secondary) !important; |
| font-weight: 400 !important; |
| margin: 0 !important; |
| max-width: 600px; |
| margin: 0 auto !important; |
| } |
| |
| /* Override Gradio h1 */ |
| h1 { |
| font-size: 2.5rem !important; |
| font-weight: 700 !important; |
| color: var(--text-primary) !important; |
| letter-spacing: -0.025em !important; |
| text-align: center !important; |
| margin-bottom: 0.5rem !important; |
| } |
| |
| /* Tab styling */ |
| .tabs { |
| border: none !important; |
| background: transparent !important; |
| } |
| |
| .tab-nav { |
| background: var(--bg-card) !important; |
| border-radius: var(--radius-lg) !important; |
| padding: 6px !important; |
| border: 1px solid var(--border-color) !important; |
| display: inline-flex !important; |
| gap: 4px !important; |
| margin-bottom: 2rem !important; |
| } |
| |
| .tab-nav button { |
| background: transparent !important; |
| border: none !important; |
| border-radius: var(--radius-md) !important; |
| padding: 0.625rem 1.25rem !important; |
| font-size: 0.9375rem !important; |
| font-weight: 500 !important; |
| color: var(--text-secondary) !important; |
| transition: all var(--transition-fast) !important; |
| cursor: pointer !important; |
| } |
| |
| .tab-nav button:hover { |
| color: var(--text-primary) !important; |
| background: var(--bg-secondary) !important; |
| } |
| |
| .tab-nav button.selected { |
| background: var(--bg-primary) !important; |
| color: var(--text-primary) !important; |
| box-shadow: var(--shadow-sm) !important; |
| } |
| |
| /* Dataset Card */ |
| .dataset-card { |
| background: var(--bg-card); |
| border: 1px solid var(--border-color); |
| border-radius: var(--radius-xl); |
| padding: 1.5rem; |
| margin-bottom: 1rem; |
| transition: all var(--transition-base); |
| position: relative; |
| overflow: hidden; |
| } |
| |
| .dataset-card::before { |
| content: ''; |
| position: absolute; |
| top: 0; |
| left: 0; |
| right: 0; |
| height: 3px; |
| background: linear-gradient(90deg, var(--accent-blue), var(--accent-green)); |
| opacity: 0; |
| transition: opacity var(--transition-base); |
| } |
| |
| .dataset-card:hover { |
| border-color: var(--border-color-strong); |
| box-shadow: var(--shadow-card-hover); |
| transform: translateY(-2px); |
| } |
| |
| .dataset-card:hover::before { |
| opacity: 1; |
| } |
| |
| .card-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: flex-start; |
| gap: 1rem; |
| margin-bottom: 0.75rem; |
| } |
| |
| .card-title { |
| font-size: 1.25rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| margin: 0; |
| line-height: 1.3; |
| letter-spacing: -0.01em; |
| } |
| |
| .card-badge { |
| background: var(--bg-secondary); |
| color: var(--text-secondary); |
| padding: 0.375rem 0.875rem; |
| border-radius: var(--radius-full); |
| font-size: 0.75rem; |
| font-weight: 500; |
| text-transform: uppercase; |
| letter-spacing: 0.04em; |
| white-space: nowrap; |
| border: 1px solid var(--border-color); |
| } |
| |
| .card-description { |
| color: var(--text-secondary); |
| font-size: 0.9375rem; |
| line-height: 1.6; |
| margin: 0 0 1.25rem 0; |
| } |
| |
| .card-footer { |
| display: flex; |
| gap: 0.75rem; |
| align-items: center; |
| flex-wrap: wrap; |
| } |
| |
| /* Button styling */ |
| .btn { |
| display: inline-flex; |
| align-items: center; |
| justify-content: center; |
| gap: 0.5rem; |
| padding: 0.625rem 1.25rem; |
| border-radius: var(--radius-full); |
| font-size: 0.875rem; |
| font-weight: 500; |
| text-decoration: none; |
| cursor: pointer; |
| transition: all var(--transition-fast); |
| border: none; |
| outline: none; |
| } |
| |
| .btn-primary { |
| background: var(--text-primary); |
| color: var(--bg-primary); |
| } |
| |
| .btn-primary:hover { |
| opacity: 0.85; |
| transform: scale(1.02); |
| } |
| |
| .btn-secondary { |
| background: transparent; |
| color: var(--text-primary); |
| border: 1px solid var(--border-color-strong); |
| } |
| |
| .btn-secondary:hover { |
| background: var(--bg-secondary); |
| border-color: var(--text-tertiary); |
| } |
| |
| .btn-accent { |
| background: var(--accent-blue); |
| color: white; |
| } |
| |
| .btn-accent:hover { |
| background: var(--accent-blue-hover); |
| transform: scale(1.02); |
| } |
| |
| /* Price tag */ |
| .price-tag { |
| font-size: 1rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| display: flex; |
| align-items: baseline; |
| gap: 0.25rem; |
| } |
| |
| .price-tag .currency { |
| font-size: 0.875rem; |
| font-weight: 500; |
| } |
| |
| .price-tag .period { |
| font-size: 0.75rem; |
| color: var(--text-tertiary); |
| font-weight: 400; |
| } |
| |
| .price-free { |
| color: var(--accent-green); |
| } |
| |
| /* Empty state */ |
| .empty-state { |
| text-align: center; |
| padding: 4rem 2rem; |
| color: var(--text-secondary); |
| } |
| |
| .empty-state-icon { |
| font-size: 3rem; |
| margin-bottom: 1rem; |
| opacity: 0.5; |
| } |
| |
| .empty-state-title { |
| font-size: 1.25rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| margin-bottom: 0.5rem; |
| } |
| |
| .empty-state-text { |
| font-size: 0.9375rem; |
| color: var(--text-secondary); |
| } |
| |
| /* Admin section */ |
| .admin-section { |
| background: var(--bg-card); |
| border: 1px solid var(--border-color); |
| border-radius: var(--radius-xl); |
| padding: 1.5rem; |
| margin-bottom: 1.5rem; |
| } |
| |
| .admin-section-title { |
| font-size: 1.125rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| margin: 0 0 1rem 0; |
| display: flex; |
| align-items: center; |
| gap: 0.5rem; |
| } |
| |
| /* Form styling */ |
| .form-group { |
| margin-bottom: 1rem; |
| } |
| |
| .form-label { |
| display: block; |
| font-size: 0.875rem; |
| font-weight: 500; |
| color: var(--text-primary); |
| margin-bottom: 0.5rem; |
| } |
| |
| /* Gradio component overrides */ |
| .gradio-container .gr-button { |
| border-radius: var(--radius-full) !important; |
| font-weight: 500 !important; |
| transition: all var(--transition-fast) !important; |
| } |
| |
| .gradio-container .gr-button-primary { |
| background: var(--text-primary) !important; |
| border: none !important; |
| } |
| |
| .gradio-container .gr-button-secondary { |
| background: transparent !important; |
| border: 1px solid var(--border-color-strong) !important; |
| color: var(--text-primary) !important; |
| } |
| |
| .gradio-container .gr-input, |
| .gradio-container .gr-text-input, |
| .gradio-container textarea { |
| background: var(--bg-secondary) !important; |
| border: 1px solid var(--border-color) !important; |
| border-radius: var(--radius-md) !important; |
| color: var(--text-primary) !important; |
| transition: all var(--transition-fast) !important; |
| } |
| |
| .gradio-container .gr-input:focus, |
| .gradio-container .gr-text-input:focus, |
| .gradio-container textarea:focus { |
| border-color: var(--accent-blue) !important; |
| box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15) !important; |
| } |
| |
| .gradio-container .gr-box { |
| background: var(--bg-card) !important; |
| border: 1px solid var(--border-color) !important; |
| border-radius: var(--radius-lg) !important; |
| } |
| |
| .gradio-container .gr-panel { |
| background: var(--bg-card) !important; |
| border: 1px solid var(--border-color) !important; |
| border-radius: var(--radius-lg) !important; |
| } |
| |
| /* Group styling */ |
| .gradio-container .gr-group { |
| background: transparent !important; |
| border: none !important; |
| padding: 0 !important; |
| } |
| |
| /* JSON viewer */ |
| .gradio-container .gr-json { |
| background: var(--bg-secondary) !important; |
| border-radius: var(--radius-md) !important; |
| } |
| |
| /* Markdown text color */ |
| .gradio-container .prose { |
| color: var(--text-primary) !important; |
| } |
| |
| .gradio-container .prose h1, |
| .gradio-container .prose h2, |
| .gradio-container .prose h3 { |
| color: var(--text-primary) !important; |
| } |
| |
| .gradio-container .prose p { |
| color: var(--text-secondary) !important; |
| } |
| |
| /* Row and column spacing */ |
| .gradio-container .gr-row { |
| gap: 0.75rem !important; |
| } |
| |
| /* Status message styling */ |
| .status-success { |
| background: rgba(48, 209, 88, 0.1); |
| border: 1px solid rgba(48, 209, 88, 0.2); |
| color: var(--accent-green); |
| padding: 0.75rem 1rem; |
| border-radius: var(--radius-md); |
| font-size: 0.875rem; |
| } |
| |
| .status-error { |
| background: rgba(255, 69, 58, 0.1); |
| border: 1px solid rgba(255, 69, 58, 0.2); |
| color: #ff453a; |
| padding: 0.75rem 1rem; |
| border-radius: var(--radius-md); |
| font-size: 0.875rem; |
| } |
| |
| /* Subscription card specific */ |
| .subscription-card { |
| background: var(--bg-card); |
| border: 1px solid var(--border-color); |
| border-radius: var(--radius-xl); |
| padding: 1.25rem 1.5rem; |
| margin-bottom: 0.75rem; |
| display: flex; |
| align-items: center; |
| justify-content: space-between; |
| gap: 1rem; |
| transition: all var(--transition-base); |
| } |
| |
| .subscription-card:hover { |
| border-color: var(--border-color-strong); |
| box-shadow: var(--shadow-card); |
| } |
| |
| .subscription-info { |
| flex: 1; |
| } |
| |
| .subscription-dataset { |
| font-size: 1rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| margin: 0 0 0.25rem 0; |
| } |
| |
| .subscription-meta { |
| font-size: 0.8125rem; |
| color: var(--text-tertiary); |
| display: flex; |
| gap: 1rem; |
| align-items: center; |
| } |
| |
| .subscription-status { |
| display: inline-flex; |
| align-items: center; |
| gap: 0.375rem; |
| padding: 0.25rem 0.625rem; |
| border-radius: var(--radius-full); |
| font-size: 0.75rem; |
| font-weight: 500; |
| } |
| |
| .subscription-status.active { |
| background: rgba(48, 209, 88, 0.15); |
| color: var(--accent-green); |
| } |
| |
| .subscription-status.expired { |
| background: rgba(255, 69, 58, 0.15); |
| color: #ff453a; |
| } |
| |
| /* Login card */ |
| .login-card { |
| background: var(--bg-card); |
| border: 1px solid var(--border-color); |
| border-radius: var(--radius-xl); |
| padding: 2rem; |
| max-width: 400px; |
| margin: 2rem auto; |
| text-align: center; |
| } |
| |
| .login-card-title { |
| font-size: 1.25rem; |
| font-weight: 600; |
| color: var(--text-primary); |
| margin: 0 0 0.5rem 0; |
| } |
| |
| .login-card-subtitle { |
| font-size: 0.9375rem; |
| color: var(--text-secondary); |
| margin: 0 0 1.5rem 0; |
| } |
| |
| /* Stats grid */ |
| .stats-grid { |
| display: grid; |
| grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); |
| gap: 1rem; |
| margin-bottom: 1.5rem; |
| } |
| |
| .stat-card { |
| background: var(--bg-card); |
| border: 1px solid var(--border-color); |
| border-radius: var(--radius-lg); |
| padding: 1.25rem; |
| text-align: center; |
| } |
| |
| .stat-value { |
| font-size: 2rem; |
| font-weight: 700; |
| color: var(--text-primary); |
| line-height: 1; |
| margin-bottom: 0.25rem; |
| } |
| |
| .stat-label { |
| font-size: 0.8125rem; |
| color: var(--text-tertiary); |
| text-transform: uppercase; |
| letter-spacing: 0.04em; |
| } |
| |
| /* Animation */ |
| @keyframes fadeIn { |
| from { opacity: 0; transform: translateY(10px); } |
| to { opacity: 1; transform: translateY(0); } |
| } |
| |
| .animate-in { |
| animation: fadeIn 0.3s ease-out forwards; |
| } |
| |
| /* Responsive adjustments */ |
| @media (max-width: 768px) { |
| .hero-title { |
| font-size: 2rem !important; |
| } |
| |
| .hero-subtitle { |
| font-size: 1rem !important; |
| } |
| |
| .card-header { |
| flex-direction: column; |
| gap: 0.5rem; |
| } |
| |
| .card-footer { |
| flex-direction: column; |
| align-items: stretch; |
| } |
| |
| .subscription-card { |
| flex-direction: column; |
| align-items: stretch; |
| } |
| } |
| """ |
|
|