Sasha Rush commited on
Commit
a429109
1 Parent(s): 68b37fb
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -541,6 +541,7 @@ The score is the number of output tokens your solution takes.
541
  with gr.Row() as row:
542
  team_name = gr.Text(label="Team Name")
543
  leaderboard = gr.Button(value="Submit")
 
544
  msg = gr.Text(label="Status")
545
  leader = gr.Dataframe(pd.read_csv(DATA_FILE)[["team", "board", "count"]].sort_values(["board", "count"]))
546
  def leaderfn(data):
@@ -558,10 +559,17 @@ The score is the number of output tokens your solution takes.
558
  commit_url = repo.push_to_hub()
559
  leader_df = pd.read_csv(DATA_FILE)[["team", "board", "count"]]
560
  leader_df = leader_df.sort_values(["board", "count"])
561
- return {msg: f"Sucess: Final score: {count} {board}", leader: leader_df}
562
 
563
- leaderboard.click(fn=leaderfn, inputs={state, team_name}, outputs={msg, leader})
564
 
 
 
 
 
 
 
 
565
  app.queue().launch()
566
 
567
 
 
541
  with gr.Row() as row:
542
  team_name = gr.Text(label="Team Name")
543
  leaderboard = gr.Button(value="Submit")
544
+ refresh = gr.Button(value="Refresh")
545
  msg = gr.Text(label="Status")
546
  leader = gr.Dataframe(pd.read_csv(DATA_FILE)[["team", "board", "count"]].sort_values(["board", "count"]))
547
  def leaderfn(data):
 
559
  commit_url = repo.push_to_hub()
560
  leader_df = pd.read_csv(DATA_FILE)[["team", "board", "count"]]
561
  leader_df = leader_df.sort_values(["board", "count"])
562
+ return {msg: f"Success: Final score: {count} {board}", leader: leader_df}
563
 
564
+ leaderboard.click(fn=leaderfn, inputs={state, team_name}, outputs={msg, leader})
565
 
566
+ def refreshfn():
567
+ repo.git_pull()
568
+ leader_df = pd.read_csv(DATA_FILE)[["team", "board", "count"]]
569
+ leader_df = leader_df.sort_values(["board", "count"])
570
+ return {msg: f"Refreshed", leader: leader_df}
571
+
572
+ refresh.click(fn=refreshfn, output={msg, leader})
573
  app.queue().launch()
574
 
575