Abhishek Thakur commited on
Commit
b745d94
·
1 Parent(s): 2d208af

disable public lb flag

Browse files
Files changed (1) hide show
  1. competitions/app.py +8 -3
competitions/app.py CHANGED
@@ -23,9 +23,11 @@ from competitions.text import SUBMISSION_SELECTION_TEXT, SUBMISSION_TEXT
23
 
24
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
25
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
26
- COMPETITION_ID = os.getenv("COMPETITION_ID")
27
- OUTPUT_PATH = os.getenv("OUTPUT_PATH", "/tmp/model")
28
- START_DATE = os.getenv("START_DATE", "2000-12-31")
 
 
29
 
30
  disable_progress_bars()
31
 
@@ -116,6 +118,9 @@ async def get_submission_info(request: Request):
116
 
117
  @app.get("/leaderboard/{lb}", response_class=JSONResponse)
118
  async def get_leaderboard(request: Request, lb: str):
 
 
 
119
  leaderboard = Leaderboard(
120
  end_date=COMP_INFO.end_date,
121
  eval_higher_is_better=COMP_INFO.eval_higher_is_better,
 
23
 
24
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
25
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
26
+ COMPETITION_ID = os.environ.get("COMPETITION_ID")
27
+ OUTPUT_PATH = os.environ.get("OUTPUT_PATH", "/tmp/model")
28
+ START_DATE = os.environ.get("START_DATE", "2000-12-31")
29
+ DISABLE_PUBLIC_LB = int(os.environ.get("DISABLE_PUBLIC_LB", 0))
30
+
31
 
32
  disable_progress_bars()
33
 
 
118
 
119
  @app.get("/leaderboard/{lb}", response_class=JSONResponse)
120
  async def get_leaderboard(request: Request, lb: str):
121
+ if DISABLE_PUBLIC_LB == 1 and lb == "public":
122
+ return {"response": "Public leaderboard is disabled by the competition host."}
123
+
124
  leaderboard = Leaderboard(
125
  end_date=COMP_INFO.end_date,
126
  eval_higher_is_better=COMP_INFO.eval_higher_is_better,