utkarshshukla2912 commited on
Commit
63d250f
·
1 Parent(s): 69bfab8

base space

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -2,10 +2,10 @@ import gradio as gr
2
  import requests
3
  import json
4
  import os
5
- import base64
6
 
7
  # API Base URL
8
- BASE_URL = os.environ.get("BASE_URL", "http://localhost:8889")
 
9
 
10
  # Custom CSS for aesthetic design
11
  custom_css = """
@@ -358,8 +358,15 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
358
  ],
359
  )
360
 
361
- # Refresh health status every 120 seconds
362
- demo.load(lambda: get_title_with_status(), outputs=[health_status], every=120)
 
 
 
 
 
 
 
363
 
364
  if __name__ == "__main__":
365
  demo.queue()
 
2
  import requests
3
  import json
4
  import os
 
5
 
6
  # API Base URL
7
+ BASE_URL = os.environ.get("BASE_URL", "")
8
+
9
 
10
  # Custom CSS for aesthetic design
11
  custom_css = """
 
358
  ],
359
  )
360
 
361
+ # Refresh health status on load
362
+ demo.load(fn=get_title_with_status, outputs=[health_status])
363
+
364
+ # Set up periodic refresh if Timer is available
365
+ try:
366
+ health_timer = gr.Timer(value=120)
367
+ health_timer.tick(fn=get_title_with_status, outputs=[health_status])
368
+ except Exception:
369
+ pass # Timer not available in this Gradio version
370
 
371
  if __name__ == "__main__":
372
  demo.queue()