Siraja704 commited on
Commit
88ce90f
·
1 Parent(s): b8cabae

Fix text and icon visibility with proper contrast

Browse files
Files changed (1) hide show
  1. app.py +111 -46
app.py CHANGED
@@ -189,8 +189,8 @@ custom_css = """
189
  --bg-secondary: #2d2d2d;
190
  --bg-accent: #1e3a8a;
191
  --bg-warning: #4d3800;
192
- --text-primary: #f8f9fa;
193
- --text-secondary: #adb5bd;
194
  --text-accent: #90caf9;
195
  --text-warning: #ffd60a;
196
  --border-color: #495057;
@@ -200,6 +200,12 @@ custom_css = """
200
  }
201
  }
202
 
 
 
 
 
 
 
203
  /* Medical disclaimer styling */
204
  .medical-disclaimer {
205
  background-color: var(--bg-warning);
@@ -207,20 +213,16 @@ custom_css = """
207
  border-radius: 12px;
208
  padding: 20px;
209
  margin: 15px 0;
210
- color: var(--text-warning);
211
  box-shadow: 0 4px 6px var(--shadow);
212
  transition: all 0.3s ease;
213
  }
214
 
215
- .medical-disclaimer h3 {
216
- color: var(--text-warning);
 
 
217
  margin-top: 0;
218
  font-weight: 600;
219
- }
220
-
221
- .medical-disclaimer p {
222
- color: var(--text-warning);
223
- margin-bottom: 0;
224
  line-height: 1.5;
225
  }
226
 
@@ -242,19 +244,18 @@ custom_css = """
242
  border-radius: 12px;
243
  padding: 20px;
244
  margin: 15px 0;
245
- color: var(--text-accent);
246
  box-shadow: 0 4px 6px var(--shadow);
247
  transition: all 0.3s ease;
248
  }
249
 
250
- .info-box h3, .info-box h4 {
251
- color: var(--text-accent);
 
 
 
 
252
  margin-top: 0;
253
  font-weight: 600;
254
- }
255
-
256
- .info-box p, .info-box li {
257
- color: var(--text-accent);
258
  line-height: 1.5;
259
  }
260
 
@@ -270,19 +271,20 @@ custom_css = """
270
  }
271
 
272
  .about-section h3 {
273
- color: var(--text-primary);
274
  margin-top: 0;
275
  font-weight: 600;
276
  }
277
 
278
- .about-section p {
279
- color: var(--text-secondary);
 
280
  line-height: 1.6;
281
  margin-bottom: 10px;
282
  }
283
 
284
  .about-section a {
285
- color: var(--text-accent);
286
  text-decoration: none;
287
  font-weight: 500;
288
  }
@@ -299,7 +301,7 @@ custom_css = """
299
  }
300
 
301
  .main-title h1 {
302
- color: var(--text-primary);
303
  font-size: 2.5rem;
304
  font-weight: 700;
305
  margin-bottom: 10px;
@@ -307,14 +309,14 @@ custom_css = """
307
  }
308
 
309
  .main-title p {
310
- color: var(--text-secondary);
311
  font-size: 1.2rem;
312
  font-weight: 400;
313
  }
314
 
315
  /* Section headers */
316
  .section-header {
317
- color: var(--text-primary);
318
  font-size: 1.4rem;
319
  font-weight: 600;
320
  margin-bottom: 15px;
@@ -334,6 +336,7 @@ custom_css = """
334
  border-radius: 8px;
335
  border: 1px solid var(--border-color);
336
  transition: all 0.3s ease;
 
337
  }
338
 
339
  .condition-item:hover {
@@ -342,18 +345,14 @@ custom_css = """
342
  }
343
 
344
  .condition-item strong {
345
- color: var(--text-primary);
346
  }
347
 
348
- .condition-item {
349
- color: var(--text-secondary);
350
- }
351
-
352
- /* Button and input styling improvements */
353
  .gradio-container .gr-button {
354
- background-color: var(--bg-accent);
355
- color: var(--text-accent);
356
- border: 2px solid var(--border-accent);
357
  border-radius: 8px;
358
  font-weight: 500;
359
  transition: all 0.3s ease;
@@ -366,32 +365,98 @@ custom_css = """
366
 
367
  /* Upload area styling */
368
  .gradio-container .gr-file-upload {
369
- border: 2px dashed var(--border-accent);
370
  border-radius: 12px;
371
- background-color: var(--bg-secondary);
372
  transition: all 0.3s ease;
 
373
  }
374
 
375
  .gradio-container .gr-file-upload:hover {
376
- border-color: var(--text-accent);
377
- background-color: var(--bg-accent);
378
  }
379
 
380
  /* Results area styling */
381
  .gradio-container .gr-label {
382
- background-color: var(--bg-secondary);
383
- border: 1px solid var(--border-color);
384
  border-radius: 8px;
385
- color: var(--text-primary);
386
  }
387
 
388
- /* Ensure all text is visible */
389
- * {
390
- color: var(--text-primary);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  }
392
 
393
- p, span, div {
394
- color: inherit;
 
 
 
 
395
  }
396
  """
397
 
@@ -410,7 +475,7 @@ with gr.Blocks(
410
 
411
  gr.HTML("""
412
  <div class="main-title">
413
- <h1>🏥 DermaAI - Skin Disease Classification</h1>
414
  <p>AI-powered skin condition analysis using deep learning</p>
415
  </div>
416
  """)
 
189
  --bg-secondary: #2d2d2d;
190
  --bg-accent: #1e3a8a;
191
  --bg-warning: #4d3800;
192
+ --text-primary: #ffffff;
193
+ --text-secondary: #e9ecef;
194
  --text-accent: #90caf9;
195
  --text-warning: #ffd60a;
196
  --border-color: #495057;
 
200
  }
201
  }
202
 
203
+ /* Force text colors for all elements */
204
+ .gradio-container,
205
+ .gradio-container * {
206
+ color: var(--text-primary) !important;
207
+ }
208
+
209
  /* Medical disclaimer styling */
210
  .medical-disclaimer {
211
  background-color: var(--bg-warning);
 
213
  border-radius: 12px;
214
  padding: 20px;
215
  margin: 15px 0;
 
216
  box-shadow: 0 4px 6px var(--shadow);
217
  transition: all 0.3s ease;
218
  }
219
 
220
+ .medical-disclaimer h3,
221
+ .medical-disclaimer p,
222
+ .medical-disclaimer strong {
223
+ color: var(--text-warning) !important;
224
  margin-top: 0;
225
  font-weight: 600;
 
 
 
 
 
226
  line-height: 1.5;
227
  }
228
 
 
244
  border-radius: 12px;
245
  padding: 20px;
246
  margin: 15px 0;
 
247
  box-shadow: 0 4px 6px var(--shadow);
248
  transition: all 0.3s ease;
249
  }
250
 
251
+ .info-box h3,
252
+ .info-box h4,
253
+ .info-box p,
254
+ .info-box li,
255
+ .info-box strong {
256
+ color: var(--text-accent) !important;
257
  margin-top: 0;
258
  font-weight: 600;
 
 
 
 
259
  line-height: 1.5;
260
  }
261
 
 
271
  }
272
 
273
  .about-section h3 {
274
+ color: var(--text-primary) !important;
275
  margin-top: 0;
276
  font-weight: 600;
277
  }
278
 
279
+ .about-section p,
280
+ .about-section strong {
281
+ color: var(--text-secondary) !important;
282
  line-height: 1.6;
283
  margin-bottom: 10px;
284
  }
285
 
286
  .about-section a {
287
+ color: var(--text-accent) !important;
288
  text-decoration: none;
289
  font-weight: 500;
290
  }
 
301
  }
302
 
303
  .main-title h1 {
304
+ color: var(--text-primary) !important;
305
  font-size: 2.5rem;
306
  font-weight: 700;
307
  margin-bottom: 10px;
 
309
  }
310
 
311
  .main-title p {
312
+ color: var(--text-secondary) !important;
313
  font-size: 1.2rem;
314
  font-weight: 400;
315
  }
316
 
317
  /* Section headers */
318
  .section-header {
319
+ color: var(--text-primary) !important;
320
  font-size: 1.4rem;
321
  font-weight: 600;
322
  margin-bottom: 15px;
 
336
  border-radius: 8px;
337
  border: 1px solid var(--border-color);
338
  transition: all 0.3s ease;
339
+ color: var(--text-secondary) !important;
340
  }
341
 
342
  .condition-item:hover {
 
345
  }
346
 
347
  .condition-item strong {
348
+ color: var(--text-primary) !important;
349
  }
350
 
351
+ /* Gradio component overrides for proper theming */
 
 
 
 
352
  .gradio-container .gr-button {
353
+ background-color: var(--bg-accent) !important;
354
+ color: var(--text-accent) !important;
355
+ border: 2px solid var(--border-accent) !important;
356
  border-radius: 8px;
357
  font-weight: 500;
358
  transition: all 0.3s ease;
 
365
 
366
  /* Upload area styling */
367
  .gradio-container .gr-file-upload {
368
+ border: 2px dashed var(--border-accent) !important;
369
  border-radius: 12px;
370
+ background-color: var(--bg-secondary) !important;
371
  transition: all 0.3s ease;
372
+ color: var(--text-primary) !important;
373
  }
374
 
375
  .gradio-container .gr-file-upload:hover {
376
+ border-color: var(--text-accent) !important;
377
+ background-color: var(--bg-accent) !important;
378
  }
379
 
380
  /* Results area styling */
381
  .gradio-container .gr-label {
382
+ background-color: var(--bg-secondary) !important;
383
+ border: 1px solid var(--border-color) !important;
384
  border-radius: 8px;
385
+ color: var(--text-primary) !important;
386
  }
387
 
388
+ /* Image upload component */
389
+ .gradio-container .gr-image {
390
+ background-color: var(--bg-secondary) !important;
391
+ border: 1px solid var(--border-color) !important;
392
+ border-radius: 8px;
393
+ }
394
+
395
+ /* Input labels and text */
396
+ .gradio-container label,
397
+ .gradio-container .gr-label-text,
398
+ .gradio-container .gr-input-label {
399
+ color: var(--text-primary) !important;
400
+ font-weight: 500;
401
+ }
402
+
403
+ /* Markdown content */
404
+ .gradio-container .gr-markdown,
405
+ .gradio-container .gr-markdown * {
406
+ color: var(--text-primary) !important;
407
+ }
408
+
409
+ .gradio-container .gr-markdown strong {
410
+ color: var(--text-primary) !important;
411
+ font-weight: 600;
412
+ }
413
+
414
+ /* Icons and SVG elements */
415
+ .gradio-container svg,
416
+ .gradio-container .gr-icon {
417
+ fill: var(--text-primary) !important;
418
+ color: var(--text-primary) !important;
419
+ }
420
+
421
+ /* Placeholder text */
422
+ .gradio-container ::placeholder {
423
+ color: var(--text-secondary) !important;
424
+ opacity: 0.7;
425
+ }
426
+
427
+ /* Ensure high contrast for readability */
428
+ @media (prefers-color-scheme: dark) {
429
+ .gradio-container,
430
+ .gradio-container *:not(.medical-disclaimer *):not(.info-box *):not(.about-section *) {
431
+ color: #ffffff !important;
432
+ }
433
+
434
+ .gradio-container svg,
435
+ .gradio-container .gr-icon {
436
+ fill: #ffffff !important;
437
+ stroke: #ffffff !important;
438
+ }
439
+ }
440
+
441
+ @media (prefers-color-scheme: light) {
442
+ .gradio-container,
443
+ .gradio-container *:not(.medical-disclaimer *):not(.info-box *):not(.about-section *) {
444
+ color: #212529 !important;
445
+ }
446
+
447
+ .gradio-container svg,
448
+ .gradio-container .gr-icon {
449
+ fill: #212529 !important;
450
+ stroke: #212529 !important;
451
+ }
452
  }
453
 
454
+ /* Force visibility for all text elements */
455
+ .gradio-container h1, .gradio-container h2, .gradio-container h3,
456
+ .gradio-container h4, .gradio-container h5, .gradio-container h6,
457
+ .gradio-container p, .gradio-container span, .gradio-container div,
458
+ .gradio-container label, .gradio-container button {
459
+ color: var(--text-primary) !important;
460
  }
461
  """
462
 
 
475
 
476
  gr.HTML("""
477
  <div class="main-title">
478
+ <h1 style="color: var(--text-primary);">🏥 DermaAI - Skin Disease Classification</h1>
479
  <p>AI-powered skin condition analysis using deep learning</p>
480
  </div>
481
  """)