Umair Khan
commited on
Commit
·
ed0530f
1
Parent(s):
db72a46
add light logo
Browse files- app.py +25 -1
- tahoe-white-logo.png +0 -0
app.py
CHANGED
|
@@ -120,6 +120,13 @@ def ensure_dropdowns(fileobj):
|
|
| 120 |
gr.Dropdown(choices=[], value=None),
|
| 121 |
)
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
# custom callback to report progress to Gradio
|
| 124 |
class GradioProgressCallback(Callback):
|
| 125 |
def __init__(self, progress, total_batches, start=0.25, end=0.75):
|
|
@@ -415,8 +422,24 @@ div#tahoe-logo {
|
|
| 415 |
"""
|
| 416 |
with gr.Blocks(title=APP_TITLE, css=css) as demo:
|
| 417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
# header
|
| 419 |
-
gr.Image(
|
| 420 |
value="tahoe-navy-logo.png",
|
| 421 |
height=50,
|
| 422 |
label=None,
|
|
@@ -429,6 +452,7 @@ with gr.Blocks(title=APP_TITLE, css=css) as demo:
|
|
| 429 |
show_download_button=False
|
| 430 |
)
|
| 431 |
gr.Markdown(f"# {APP_TITLE}\n{APP_DESC}")
|
|
|
|
| 432 |
|
| 433 |
# file upload block
|
| 434 |
f_in = gr.File(label="Upload .h5ad", file_types=[".h5ad"], type="filepath")
|
|
|
|
| 120 |
gr.Dropdown(choices=[], value=None),
|
| 121 |
)
|
| 122 |
|
| 123 |
+
# pick logo file given theme
|
| 124 |
+
def pick_logo(theme):
|
| 125 |
+
if theme == "dark":
|
| 126 |
+
return "tahoe-navy-logo.png"
|
| 127 |
+
else:
|
| 128 |
+
return "tahoe-white-logo.png"
|
| 129 |
+
|
| 130 |
# custom callback to report progress to Gradio
|
| 131 |
class GradioProgressCallback(Callback):
|
| 132 |
def __init__(self, progress, total_batches, start=0.25, end=0.75):
|
|
|
|
| 422 |
"""
|
| 423 |
with gr.Blocks(title=APP_TITLE, css=css) as demo:
|
| 424 |
|
| 425 |
+
# figure out theme
|
| 426 |
+
theme_state = gr.State("light")
|
| 427 |
+
demo.load(
|
| 428 |
+
None,
|
| 429 |
+
None,
|
| 430 |
+
[theme_state],
|
| 431 |
+
_js="""
|
| 432 |
+
(x) => {
|
| 433 |
+
const match = window.matchMedia('(prefers-color-scheme: dark)');
|
| 434 |
+
const getTheme = () => (match.matches ? 'dark' : 'light');
|
| 435 |
+
match.onchange = () => window.gradioURL('/reset'); // reloads the Blocks, optional
|
| 436 |
+
return getTheme();
|
| 437 |
+
}
|
| 438 |
+
""",
|
| 439 |
+
)
|
| 440 |
+
|
| 441 |
# header
|
| 442 |
+
logo = gr.Image(
|
| 443 |
value="tahoe-navy-logo.png",
|
| 444 |
height=50,
|
| 445 |
label=None,
|
|
|
|
| 452 |
show_download_button=False
|
| 453 |
)
|
| 454 |
gr.Markdown(f"# {APP_TITLE}\n{APP_DESC}")
|
| 455 |
+
demo.load(pick_logo, inputs=[theme_state], outputs=[logo], queue=False)
|
| 456 |
|
| 457 |
# file upload block
|
| 458 |
f_in = gr.File(label="Upload .h5ad", file_types=[".h5ad"], type="filepath")
|
tahoe-white-logo.png
ADDED
|