Spaces:
Running
Running
use all days
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ from evaluate import get_solution_code
|
|
| 7 |
|
| 8 |
# For now, only evaluate first 9 days
|
| 9 |
df = pd.read_csv("results.csv")
|
| 10 |
-
df = df[df.day < 10]
|
| 11 |
|
| 12 |
with open("solutions.json") as f:
|
| 13 |
solutions = json.load(f)
|
|
@@ -19,6 +18,20 @@ def score_submissions(row):
|
|
| 19 |
|
| 20 |
score_1 = solution[0] in result
|
| 21 |
score_2 = solution[1] in result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
return [score_1, score_2]
|
| 23 |
|
| 24 |
|
|
@@ -26,6 +39,8 @@ df["scores"] = df.apply(score_submissions, axis=1)
|
|
| 26 |
df["code"] = df.apply(lambda x: get_solution_code(day = x["day"], model=x["model"]), axis=1)
|
| 27 |
df["code_md"] = df.code.apply(lambda x: "```python"+x+"```")
|
| 28 |
|
|
|
|
|
|
|
| 29 |
df["part_1"] = df["scores"].apply(lambda x: x[0])
|
| 30 |
df["part_2"] = df["scores"].apply(lambda x: x[1])
|
| 31 |
|
|
@@ -33,6 +48,8 @@ df["part_2"] = df["scores"].apply(lambda x: x[1])
|
|
| 33 |
star_summary = {}
|
| 34 |
for model in df.model.unique():
|
| 35 |
df_model = df[df.model == model]
|
|
|
|
|
|
|
| 36 |
silver_stars = df_model.part_1.sum()
|
| 37 |
gold_stars = df_model.part_2.sum()
|
| 38 |
total_stars = silver_stars + gold_stars
|
|
@@ -45,6 +62,16 @@ for model in df.model.unique():
|
|
| 45 |
|
| 46 |
star_df = pd.DataFrame.from_dict(star_summary, orient="index")
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
with gr.Blocks() as demo:
|
| 49 |
md = gr.Markdown("Hello!")
|
| 50 |
with gr.Tab("Stars"):
|
|
@@ -52,15 +79,15 @@ with gr.Blocks() as demo:
|
|
| 52 |
with gr.Tab("Daily"):
|
| 53 |
|
| 54 |
# Parse the info to something more readable
|
| 55 |
-
df_daily = df[["model", "day", "part_1", "part_2", "
|
| 56 |
-
df_daily["Part 1"] = df_daily["part_1"].apply(
|
| 57 |
-
df_daily["Part 2"] = df_daily["part_2"].apply(
|
| 58 |
-
df_daily["Runtime (s)"] = df_daily["total_time"].apply(lambda x: str(x)[0:6])
|
| 59 |
df_daily = df_daily[["model", "day", "Part 1", "Part 2", "Runtime (s)"]]
|
| 60 |
|
| 61 |
gr_df_daily = gr.DataFrame(df_daily.sort_values(by="day"))
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
demo.launch()
|
|
|
|
| 7 |
|
| 8 |
# For now, only evaluate first 9 days
|
| 9 |
df = pd.read_csv("results.csv")
|
|
|
|
| 10 |
|
| 11 |
with open("solutions.json") as f:
|
| 12 |
solutions = json.load(f)
|
|
|
|
| 18 |
|
| 19 |
score_1 = solution[0] in result
|
| 20 |
score_2 = solution[1] in result
|
| 21 |
+
|
| 22 |
+
# if solution[0] == "N/A":
|
| 23 |
+
# score_1 = "N/A"
|
| 24 |
+
# else:
|
| 25 |
+
# score_1 = solution[0] in result
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# if not score_1:
|
| 29 |
+
# score_2 = False # Can't get to level 2 without level 1
|
| 30 |
+
# elif solution[1] == "N/A":
|
| 31 |
+
# score_2 = "N/A" # Won't evaluate an answer i dont have
|
| 32 |
+
# else:
|
| 33 |
+
# score_2 = solution[1] in result
|
| 34 |
+
|
| 35 |
return [score_1, score_2]
|
| 36 |
|
| 37 |
|
|
|
|
| 39 |
df["code"] = df.apply(lambda x: get_solution_code(day = x["day"], model=x["model"]), axis=1)
|
| 40 |
df["code_md"] = df.code.apply(lambda x: "```python"+x+"```")
|
| 41 |
|
| 42 |
+
df["Runtime (s)"] = df["total_time"].apply(lambda x: str(x)[0:6])
|
| 43 |
+
|
| 44 |
df["part_1"] = df["scores"].apply(lambda x: x[0])
|
| 45 |
df["part_2"] = df["scores"].apply(lambda x: x[1])
|
| 46 |
|
|
|
|
| 48 |
star_summary = {}
|
| 49 |
for model in df.model.unique():
|
| 50 |
df_model = df[df.model == model]
|
| 51 |
+
# silver_stars = sum([s for s in df_model.part_1.to_list() if not isinstance(s, str)])
|
| 52 |
+
# gold_stars = sum([s for s in df_model.part_2.to_list() if not isinstance(s, str)])
|
| 53 |
silver_stars = df_model.part_1.sum()
|
| 54 |
gold_stars = df_model.part_2.sum()
|
| 55 |
total_stars = silver_stars + gold_stars
|
|
|
|
| 62 |
|
| 63 |
star_df = pd.DataFrame.from_dict(star_summary, orient="index")
|
| 64 |
|
| 65 |
+
def score_to_string(s):
|
| 66 |
+
return "⭐️" if s else "❌"
|
| 67 |
+
# if s == True:
|
| 68 |
+
# return "⭐️"
|
| 69 |
+
# elif s == False:
|
| 70 |
+
# return "❌"
|
| 71 |
+
# else:
|
| 72 |
+
# return "N/A"
|
| 73 |
+
|
| 74 |
+
|
| 75 |
with gr.Blocks() as demo:
|
| 76 |
md = gr.Markdown("Hello!")
|
| 77 |
with gr.Tab("Stars"):
|
|
|
|
| 79 |
with gr.Tab("Daily"):
|
| 80 |
|
| 81 |
# Parse the info to something more readable
|
| 82 |
+
df_daily = df[["model", "day", "part_1", "part_2", "Runtime (s)"]]
|
| 83 |
+
df_daily["Part 1"] = df_daily["part_1"].apply(score_to_string)
|
| 84 |
+
df_daily["Part 2"] = df_daily["part_2"].apply(score_to_string)
|
|
|
|
| 85 |
df_daily = df_daily[["model", "day", "Part 1", "Part 2", "Runtime (s)"]]
|
| 86 |
|
| 87 |
gr_df_daily = gr.DataFrame(df_daily.sort_values(by="day"))
|
| 88 |
|
| 89 |
+
with gr.Tab("Outputs"):
|
| 90 |
+
# gr_code_df = gr.DataFrame(df[["model", "day", "code_md", "result"]], datatype=["str", "str", "markdown", "str"])
|
| 91 |
+
gr_code_df = gr.DataFrame(df[["model", "day", "Runtime (s)", "result"]], datatype=["str", "str", "str"])
|
| 92 |
|
| 93 |
demo.launch()
|