Emperor555 commited on
Commit
4dedfa0
·
1 Parent(s): 61f5ac3

Fix dark mode input visibility with custom CSS

Browse files
Files changed (2) hide show
  1. app.py +29 -21
  2. requirements.txt +1 -1
app.py CHANGED
@@ -18,6 +18,34 @@ from src.tts import generate_speech
18
  load_dotenv()
19
 
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  def format_sources(sources: list[dict]) -> str:
22
  """Format sources as markdown."""
23
  if not sources:
@@ -134,7 +162,7 @@ def generate_audio(explanation: str, persona_name: str, progress=gr.Progress()):
134
  def create_app():
135
  """Create and configure the Gradio app."""
136
 
137
- with gr.Blocks(title="Explainor - AI Persona Explanations") as app:
138
  # Header
139
  gr.Markdown(
140
  """
@@ -294,26 +322,6 @@ def create_app():
294
  # Create the app
295
  app = create_app()
296
 
297
- CUSTOM_CSS = """
298
- /* Fix dark mode input visibility */
299
- input, textarea, select {
300
- color: var(--body-text-color) !important;
301
- background-color: var(--input-background-fill) !important;
302
- }
303
-
304
- input:hover, textarea:hover, select:hover,
305
- input:focus, textarea:focus, select:focus {
306
- color: var(--body-text-color) !important;
307
- background-color: var(--input-background-fill) !important;
308
- }
309
-
310
- /* Ensure placeholder is visible */
311
- input::placeholder, textarea::placeholder {
312
- color: var(--body-text-color-subdued) !important;
313
- opacity: 0.7;
314
- }
315
- """
316
-
317
  if __name__ == "__main__":
318
  # MCP server enabled for Gradio 5+
319
  enable_mcp = os.getenv("ENABLE_MCP_SERVER", "true").lower() == "true"
 
18
  load_dotenv()
19
 
20
 
21
+ # Custom CSS for dark mode input visibility
22
+ CUSTOM_CSS = """
23
+ /* Fix dark mode input visibility */
24
+ input, textarea, select {
25
+ color: var(--body-text-color) !important;
26
+ background-color: var(--input-background-fill) !important;
27
+ }
28
+
29
+ input:hover, textarea:hover, select:hover,
30
+ input:focus, textarea:focus, select:focus {
31
+ color: var(--body-text-color) !important;
32
+ background-color: var(--input-background-fill) !important;
33
+ }
34
+
35
+ /* Ensure placeholder is visible */
36
+ input::placeholder, textarea::placeholder {
37
+ color: var(--body-text-color-subdued) !important;
38
+ opacity: 0.7;
39
+ }
40
+
41
+ /* Force dark background on inputs */
42
+ .dark input, .dark textarea {
43
+ background-color: #374151 !important;
44
+ color: #ffffff !important;
45
+ }
46
+ """
47
+
48
+
49
  def format_sources(sources: list[dict]) -> str:
50
  """Format sources as markdown."""
51
  if not sources:
 
162
  def create_app():
163
  """Create and configure the Gradio app."""
164
 
165
+ with gr.Blocks(title="Explainor - AI Persona Explanations", css=CUSTOM_CSS) as app:
166
  # Header
167
  gr.Markdown(
168
  """
 
322
  # Create the app
323
  app = create_app()
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  if __name__ == "__main__":
326
  # MCP server enabled for Gradio 5+
327
  enable_mcp = os.getenv("ENABLE_MCP_SERVER", "true").lower() == "true"
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio[mcp]>=5.0.0
2
  elevenlabs>=1.0.0
3
  httpx>=0.25.0
4
  python-dotenv>=1.0.0
 
1
+ gradio[mcp]>=6.0.0
2
  elevenlabs>=1.0.0
3
  httpx>=0.25.0
4
  python-dotenv>=1.0.0