MrInvincible96 commited on
Commit
3edf7e2
·
verified ·
1 Parent(s): 1619b94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +74 -73
app.py CHANGED
@@ -261,94 +261,94 @@ button[role="tab"].selected {
261
  border-color: #173a59 !important;
262
  }
263
 
264
- /* 3. EXAMPLES LABEL ("Sample Business Scenarios") FIX */
265
- .examples > div:first-child,
266
- .examples > div:first-child *,
267
- .examples .label-wrap,
268
- .examples .label-wrap *,
269
- div.examples label,
270
- div.examples p,
271
- div.examples span {
 
 
 
 
 
 
 
 
272
  color: #000000 !important;
273
  font-weight: 700 !important;
274
  opacity: 1 !important;
275
  }
276
 
277
- /* 4. EXAMPLES — DATASET TABLE BASE STATE
278
- Gradio renders gr.Examples as a samples TABLE (tbody > tr > td),
279
- NOT as <button>. We must target the table rows/cells directly. */
280
- .examples table,
281
- .examples .gr-samples-table,
282
- table.gr-samples-table,
283
- .examples tbody,
284
- .examples tr,
285
- .examples td,
286
- .gradio-container .examples tr td {
287
  background-color: #ffffff !important;
 
288
  color: #000000 !important;
289
- border-color: #ccd5de !important;
290
  }
291
- .examples tr td,
292
- .examples tr td * {
 
 
 
293
  color: #000000 !important;
 
294
  opacity: 1 !important;
295
  }
296
 
297
- /* 5. EXAMPLES — HOVER + SELECTED STATE
298
- Apply the dark-blue background AND white text on the ROW and the CELL
299
- itself (td), then force every descendant white. Targeting the td color
300
- directly is what was missing before — hovering lands on the cell, not a button. */
301
- .examples tr:hover,
302
- .examples tr:hover td,
303
- .examples tbody tr:hover td,
304
- .gradio-container .examples tr:hover td,
305
- .examples tr.selected,
306
- .examples tr.selected td,
307
- .examples tr[aria-selected="true"],
308
- .examples tr[aria-selected="true"] td {
309
- background-color: #173a59 !important; /* dark blue */
 
 
 
310
  border-color: #173a59 !important;
311
  }
312
 
313
- .examples tr:hover td,
314
- .examples tr:hover td *,
315
- .examples tbody tr:hover td,
316
- .examples tbody tr:hover td *,
317
- .gradio-container .examples tr:hover td,
318
- .gradio-container .examples tr:hover td *,
319
- .examples tr.selected td,
320
- .examples tr.selected td *,
321
- .examples tr[aria-selected="true"] td,
322
- .examples tr[aria-selected="true"] td * {
323
- color: #ffffff !important; /* white text on hover */
324
- -webkit-text-fill-color: #ffffff !important;
325
- }
326
-
327
- /* 6. Fallback: in case the build renders examples as buttons/gallery items,
328
- keep the same behavior so it works either way. */
329
- .examples button,
330
- .examples [role="button"],
331
- .examples .gallery-item {
332
- background-color: #ffffff !important;
333
- border: 1px solid #ccd5de !important;
334
- }
335
- .examples button, .examples button *,
336
- .examples [role="button"], .examples [role="button"] *,
337
- .examples .gallery-item, .examples .gallery-item * {
338
- color: #000000 !important;
339
- }
340
- .examples button:hover, .examples [role="button"]:hover, .examples .gallery-item:hover,
341
- .examples button.selected, .examples [aria-selected="true"] {
342
- background-color: #173a59 !important;
343
- border-color: #173a59 !important;
344
- }
345
- .examples button:hover, .examples button:hover *,
346
- .examples [role="button"]:hover, .examples [role="button"]:hover *,
347
- .examples .gallery-item:hover, .examples .gallery-item:hover *,
348
- .examples button.selected, .examples button.selected *,
349
- .examples [aria-selected="true"], .examples [aria-selected="true"] * {
350
  color: #ffffff !important;
351
  -webkit-text-fill-color: #ffffff !important;
 
352
  }
353
  """
354
 
@@ -765,7 +765,8 @@ with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Base()) as demo:
765
  ["Users find login confusing. Stakeholders want optional sign-in where possible, a simpler user flow, faster completion, and fewer helpdesk calls."]
766
  ],
767
  inputs=notes_input,
768
- label="Sample Business Scenarios"
 
769
  )
770
 
771
  gr.HTML("</div></div>")
@@ -812,4 +813,4 @@ with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Base()) as demo:
812
  outputs=[notes_input, brd_output, stories_output, before_after_output]
813
  )
814
 
815
- demo.launch()
 
261
  border-color: #173a59 !important;
262
  }
263
 
264
+ /* =========================================================
265
+ EXAMPLES (gr.Examples -> gr.Dataset) STYLING
266
+ gr.Examples renders a gr.Dataset. Its root is .dataset, and the
267
+ clickable items are .gallery-item / table rows depending on type
268
+ (here, single-text examples render as a samples table OR as
269
+ gallery buttons depending on Gradio version). We scope everything
270
+ under our own .ba-examples class (set via elem_classes) and use
271
+ high-specificity selectors with the .gradio-container prefix to
272
+ beat Gradio's default grey :hover.
273
+ ========================================================= */
274
+
275
+ /* Section label "Sample Business Scenarios" */
276
+ .gradio-container .ba-examples .label-wrap,
277
+ .gradio-container .ba-examples .label-wrap *,
278
+ .gradio-container .ba-examples > label,
279
+ .gradio-container .ba-examples > label * {
280
  color: #000000 !important;
281
  font-weight: 700 !important;
282
  opacity: 1 !important;
283
  }
284
 
285
+ /* ---- BASE (un-hovered) state ----
286
+ Cover every form the dataset items can take: table cells,
287
+ gallery items, and generic buttons. */
288
+ .gradio-container .ba-examples .dataset td,
289
+ .gradio-container .ba-examples table td,
290
+ .gradio-container .ba-examples .gallery-item,
291
+ .gradio-container .ba-examples button,
292
+ .gradio-container .ba-examples [role="button"] {
 
 
293
  background-color: #ffffff !important;
294
+ border: 1px solid #ccd5de !important;
295
  color: #000000 !important;
 
296
  }
297
+ .gradio-container .ba-examples .dataset td *,
298
+ .gradio-container .ba-examples table td *,
299
+ .gradio-container .ba-examples .gallery-item *,
300
+ .gradio-container .ba-examples button *,
301
+ .gradio-container .ba-examples [role="button"] * {
302
  color: #000000 !important;
303
+ -webkit-text-fill-color: #000000 !important;
304
  opacity: 1 !important;
305
  }
306
 
307
+ /* ---- HOVER / SELECTED state ----
308
+ This is the part that kept failing. Gradio applies its own grey
309
+ hover with high specificity, so we match the SAME elements and
310
+ force BOTH background and text. The .gradio-container prefix +
311
+ element + pseudo gives us enough specificity to win. */
312
+ .gradio-container .ba-examples .dataset tr:hover td,
313
+ .gradio-container .ba-examples .dataset td:hover,
314
+ .gradio-container .ba-examples table tr:hover td,
315
+ .gradio-container .ba-examples table td:hover,
316
+ .gradio-container .ba-examples .gallery-item:hover,
317
+ .gradio-container .ba-examples button:hover,
318
+ .gradio-container .ba-examples [role="button"]:hover,
319
+ .gradio-container .ba-examples .gallery-item.selected,
320
+ .gradio-container .ba-examples tr.selected td,
321
+ .gradio-container .ba-examples [aria-selected="true"] {
322
+ background-color: #173a59 !important; /* dark blue */
323
  border-color: #173a59 !important;
324
  }
325
 
326
+ /* Force the TEXT white on hover/selected — target the element itself
327
+ AND all descendants, with -webkit-text-fill-color to defeat any
328
+ webkit text-fill override. */
329
+ .gradio-container .ba-examples .dataset tr:hover td,
330
+ .gradio-container .ba-examples .dataset tr:hover td *,
331
+ .gradio-container .ba-examples .dataset td:hover,
332
+ .gradio-container .ba-examples .dataset td:hover *,
333
+ .gradio-container .ba-examples table tr:hover td,
334
+ .gradio-container .ba-examples table tr:hover td *,
335
+ .gradio-container .ba-examples table td:hover,
336
+ .gradio-container .ba-examples table td:hover *,
337
+ .gradio-container .ba-examples .gallery-item:hover,
338
+ .gradio-container .ba-examples .gallery-item:hover *,
339
+ .gradio-container .ba-examples button:hover,
340
+ .gradio-container .ba-examples button:hover *,
341
+ .gradio-container .ba-examples [role="button"]:hover,
342
+ .gradio-container .ba-examples [role="button"]:hover *,
343
+ .gradio-container .ba-examples .gallery-item.selected,
344
+ .gradio-container .ba-examples .gallery-item.selected *,
345
+ .gradio-container .ba-examples tr.selected td,
346
+ .gradio-container .ba-examples tr.selected td *,
347
+ .gradio-container .ba-examples [aria-selected="true"],
348
+ .gradio-container .ba-examples [aria-selected="true"] * {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  color: #ffffff !important;
350
  -webkit-text-fill-color: #ffffff !important;
351
+ opacity: 1 !important;
352
  }
353
  """
354
 
 
765
  ["Users find login confusing. Stakeholders want optional sign-in where possible, a simpler user flow, faster completion, and fewer helpdesk calls."]
766
  ],
767
  inputs=notes_input,
768
+ label="Sample Business Scenarios",
769
+ elem_classes="ba-examples"
770
  )
771
 
772
  gr.HTML("</div></div>")
 
813
  outputs=[notes_input, brd_output, stories_output, before_after_output]
814
  )
815
 
816
+ demo.launch()