jjin6573 commited on
Commit
b58e2e5
·
verified ·
1 Parent(s): 299aa65

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +20 -23
app.py CHANGED
@@ -1115,25 +1115,10 @@ def create_similarity_visualization(result):
1115
  # ============================================================================
1116
 
1117
  custom_css = """
1118
- /* ===== FORCE DARK MODE FOR BOTH LIGHT AND DARK THEMES ===== */
1119
- :root, html, body, .gradio-container, .main, .app, [data-testid="block-container"] {
1120
- background: linear-gradient(180deg, #0a0a1a 0%, #0f0f23 100%) !important;
1121
- background-color: #0a0a1a !important;
1122
- color: #ffffff !important;
1123
- }
1124
-
1125
- /* Force dark background on all containers */
1126
- .gradio-container, .gradio-container *, .main, .main *, .app, .app * {
1127
- background-color: transparent !important;
1128
- }
1129
-
1130
- /* Force dark text colors */
1131
- .gradio-container label, .gradio-container p, .gradio-container span,
1132
- .gradio-container div:not(.card):not(.terminal-window):not([class*="button"]) {
1133
- color: #ffffff !important;
1134
- }
1135
 
1136
- /* ===== FORCE DARK MODE ===== */
1137
  :root {
1138
  color-scheme: dark !important;
1139
  }
@@ -1145,10 +1130,6 @@ body {
1145
  font-family: system-ui, -apple-system, sans-serif;
1146
  }
1147
 
1148
- .dark, [data-theme="dark"] {
1149
- color-scheme: dark !important;
1150
- }
1151
-
1152
  .gradio-container {
1153
  max-width: 100% !important;
1154
  width: 100% !important;
@@ -2072,7 +2053,23 @@ button.custom-action-btn:hover,
2072
  }
2073
  """
2074
 
2075
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2076
  # Inject custom CSS and decorative elements (positioned fixed, no DOM space)
2077
  gr.HTML(f"""
2078
  <style>{custom_css}</style>
 
1115
  # ============================================================================
1116
 
1117
  custom_css = """
1118
+ /* ===== DARK THEME STYLING ===== */
1119
+ /* Note: Dark mode is forced via JavaScript (force_dark_mode_js) using URL parameter ?__theme=dark */
1120
+ /* This CSS provides the visual styling for dark mode */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1121
 
 
1122
  :root {
1123
  color-scheme: dark !important;
1124
  }
 
1130
  font-family: system-ui, -apple-system, sans-serif;
1131
  }
1132
 
 
 
 
 
1133
  .gradio-container {
1134
  max-width: 100% !important;
1135
  width: 100% !important;
 
2053
  }
2054
  """
2055
 
2056
+ # JavaScript to force dark mode on page load
2057
+ force_dark_mode_js = """
2058
+ function() {
2059
+ // Force dark mode via URL parameter if not already set
2060
+ const url = new URL(window.location);
2061
+ if (url.searchParams.get('__theme') !== 'dark') {
2062
+ url.searchParams.set('__theme', 'dark');
2063
+ window.location.href = url.href;
2064
+ }
2065
+ // Also add dark class to body as a fallback
2066
+ document.body.classList.add('dark');
2067
+ // Set data-theme attribute
2068
+ document.documentElement.setAttribute('data-theme', 'dark');
2069
+ }
2070
+ """
2071
+
2072
+ with gr.Blocks(js=force_dark_mode_js) as demo:
2073
  # Inject custom CSS and decorative elements (positioned fixed, no DOM space)
2074
  gr.HTML(f"""
2075
  <style>{custom_css}</style>