Rajan Sharma commited on
Commit
64972fd
·
verified ·
1 Parent(s): 5802402

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
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
- demo.load(
253
- fn=lambda: None,
254
- inputs=None,
255
- outputs=user_tz_state,
256
- js="() => Intl.DateTimeFormat().resolvedOptions().timeZone"
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