Lakoc commited on
Commit
7639fd5
·
1 Parent(s): 4e05675

leaderboard server path fixes

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -14,8 +14,7 @@ EXPECTED_TOKEN = os.environ.get("SUBMISSION_TOKEN")
14
 
15
 
16
  def get_datasets_for_task(task):
17
- path = os.path.join("./references", task)
18
- print(path, os.path.exists("./references"), os.path.exists(path))
19
  if not os.path.exists(path):
20
  return []
21
  return [f.replace(".json", "") for f in os.listdir(path) if f.endswith(".json")]
@@ -41,8 +40,8 @@ def submit_model(task, datasets, hyp_file, submitted_by, model_id, token):
41
  }
42
  leaderboard_df = server.get_leaderboard()
43
  existing = leaderboard_df[
44
- (leaderboard_df["Submitted by"] == submitted_by.strip()) &
45
- (leaderboard_df["Model ID"] == model_id.strip())
46
  ]
47
  if not existing.empty:
48
  return gr.update(value="❌ A submission with this name and model ID already exists.", visible=True), \
@@ -119,5 +118,6 @@ with gr.Blocks() as demo:
119
  # lambda: gr.update(visible=True),
120
  # outputs=modal
121
  # )
122
- DATA_PATH = Path("./") # Path("/data")
123
- demo.launch(allowed_paths=[str(DATA_PATH)])
 
 
14
 
15
 
16
  def get_datasets_for_task(task):
17
+ path = os.path.join("references", task)
 
18
  if not os.path.exists(path):
19
  return []
20
  return [f.replace(".json", "") for f in os.listdir(path) if f.endswith(".json")]
 
40
  }
41
  leaderboard_df = server.get_leaderboard()
42
  existing = leaderboard_df[
43
+ (leaderboard_df["submitted_by"] == submitted_by.strip()) &
44
+ (leaderboard_df["model_id"] == model_id.strip())
45
  ]
46
  if not existing.empty:
47
  return gr.update(value="❌ A submission with this name and model ID already exists.", visible=True), \
 
118
  # lambda: gr.update(visible=True),
119
  # outputs=modal
120
  # )
121
+
122
+ if __name__ == "__main__":
123
+ demo.launch()