Umair Khan commited on
Commit
b5f7f71
·
1 Parent(s): 8f800f1

try switching between two gr.Image components

Browse files
Files changed (1) hide show
  1. app.py +31 -10
app.py CHANGED
@@ -407,24 +407,45 @@ def run_pipeline(fileobj, layer_choice, var_choice, obs_choice, use_symbols, pro
407
 
408
  # specify app layout
409
  css = """
410
- h1 {text-align: center}
411
  div#tahoe-logo {
412
  margin-top: 20px;
413
  margin-bottom: 20px;
414
  }
 
 
 
 
 
415
  """
416
  with gr.Blocks(title=APP_TITLE, css=css) as demo:
417
 
418
  # header
419
- gr.HTML(
420
- """
421
- <picture style="display:block; margin:20px auto; text-align:center">
422
- <source srcset="file=tahoe-white-logo.png" media="(prefers-color-scheme: dark)">
423
- <img id="tahoe-logo-img" src="file=tahoe-navy-logo.png" height="50" alt="Tahoe logo" style="display:inline-block">
424
- </picture>
425
- """,
426
- elem_id="tahoe-logo"
427
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  gr.Markdown(f"# {APP_TITLE}\n{APP_DESC}")
429
 
430
  # file upload block
 
407
 
408
  # specify app layout
409
  css = """
410
+ h1 {text-align: center;}
411
  div#tahoe-logo {
412
  margin-top: 20px;
413
  margin-bottom: 20px;
414
  }
415
+ #logo-dark {display: none;}
416
+ @media (prefers-color-scheme: dark) {
417
+ #logo-light {display: none;}
418
+ #logo-dark {display: block;}
419
+ }
420
  """
421
  with gr.Blocks(title=APP_TITLE, css=css) as demo:
422
 
423
  # header
424
+ with gr.Row(elem_id="tahoe-logo", equal_height=True):
425
+ light_logo = gr.Image(
426
+ value="tahoe-navy-logo.png",
427
+ height=50,
428
+ show_label=False,
429
+ container=False,
430
+ interactive=False,
431
+ elem_id="logo-light",
432
+ show_share_button=False,
433
+ show_fullscreen_button=False,
434
+ show_download_button=False,
435
+ scale=0
436
+ )
437
+ dark_logo = gr.Image(
438
+ value="tahoe-white-logo.png",
439
+ height=50,
440
+ show_label=False,
441
+ container=False,
442
+ interactive=False,
443
+ elem_id="logo-dark",
444
+ show_share_button=False,
445
+ show_fullscreen_button=False,
446
+ show_download_button=False,
447
+ scale=0
448
+ )
449
  gr.Markdown(f"# {APP_TITLE}\n{APP_DESC}")
450
 
451
  # file upload block