Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -249,12 +249,14 @@ def check_connection(user_tz=None):
|
|
| 249 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 250 |
# Capture browser timezone via JS and store in state
|
| 251 |
user_tz_state = gr.State("")
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
)
|
|
|
|
|
|
|
| 258 |
|
| 259 |
gr.Markdown(f"# Medical Decision Support AI\n{header(user_tz=None)}")
|
| 260 |
|
|
|
|
| 249 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 250 |
# Capture browser timezone via JS and store in state
|
| 251 |
user_tz_state = gr.State("")
|
| 252 |
+
# On load, capture browser timezone via JS and store in user_tz_state
|
| 253 |
+
demo.load(
|
| 254 |
+
fn=lambda tz: tz, # echo the JS value back to Gradio
|
| 255 |
+
inputs=None,
|
| 256 |
+
outputs=[user_tz_state], # outputs must be a LIST
|
| 257 |
+
js="() => Intl.DateTimeFormat().resolvedOptions().timeZone"
|
| 258 |
+
)
|
| 259 |
+
|
| 260 |
|
| 261 |
gr.Markdown(f"# Medical Decision Support AI\n{header(user_tz=None)}")
|
| 262 |
|