Jae-Won Chung commited on
Commit
aaadf66
1 Parent(s): 9bd3aab

Allow disabling Colosseum for local testing

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -23,7 +23,7 @@ pio.templates.default = "plotly_white"
23
  from spitfight.colosseum.client import ControllerClient
24
 
25
  COLOSSEUM_UP = True
26
- COLOSSEUM_BACK_ON = ""
27
 
28
 
29
  class TableManager:
@@ -371,7 +371,11 @@ Every benchmark is limited in some sense -- Before you interpret the results, pl
371
  """
372
 
373
  # The app will not start without a controller address set.
374
- controller_addr = os.environ["COLOSSEUM_CONTROLLER_ADDR"]
 
 
 
 
375
  global_controller_client = ControllerClient(controller_addr=controller_addr, timeout=15)
376
 
377
  # Load the list of models. To reload, the app should be restarted.
@@ -541,7 +545,7 @@ with gr.Blocks(css=custom_css) as block:
541
  if COLOSSEUM_UP:
542
  gr.Markdown(open("docs/colosseum_top.md").read())
543
  else:
544
- gr.HTML(f"<br/><h2 style='text-align: center'>The Colosseum is currently down. We'll be back on <u><b>{COLOSSEUM_BACK_ON}</b></u>.</h2>")
545
  gr.HTML("<h3 style='text-align: center'>The energy leaderboard is still available.</h3><br/>")
546
 
547
  with gr.Row():
 
23
  from spitfight.colosseum.client import ControllerClient
24
 
25
  COLOSSEUM_UP = True
26
+ COLOSSEUM_DOWN_MESSAGE = f"<br/><h2 style='text-align: center'>The Colosseum is currently down. We'll be back on <u><b>September 4th</b></u>.</h2>"
27
 
28
 
29
  class TableManager:
 
371
  """
372
 
373
  # The app will not start without a controller address set.
374
+ controller_addr = os.environ.get("COLOSSEUM_CONTROLLER_ADDR")
375
+ if controller_addr is None:
376
+ COLOSSEUM_UP = False
377
+ COLOSSEUM_DOWN_MESSAGE = "<br/><h2 style='text-align: center'>Disabled Colosseum for local testing.</h2>"
378
+ controller_addr = "localhost"
379
  global_controller_client = ControllerClient(controller_addr=controller_addr, timeout=15)
380
 
381
  # Load the list of models. To reload, the app should be restarted.
 
545
  if COLOSSEUM_UP:
546
  gr.Markdown(open("docs/colosseum_top.md").read())
547
  else:
548
+ gr.HTML(COLOSSEUM_DOWN_MESSAGE)
549
  gr.HTML("<h3 style='text-align: center'>The energy leaderboard is still available.</h3><br/>")
550
 
551
  with gr.Row():