Update
Browse files
app.py
CHANGED
@@ -13,19 +13,21 @@ st.title("Code Arena")
|
|
13 |
|
14 |
with st.spinner("Loading data...", show_time=True):
|
15 |
problem_dict = dict()
|
|
|
|
|
16 |
ds = load_dataset("Elfsong/leetcode_data", split='train')
|
17 |
for problem in ds:
|
18 |
-
problem_id = problem["
|
|
|
19 |
problem_dict[problem_id] = problem
|
|
|
|
|
20 |
problem_count = len(problem_dict)
|
21 |
|
22 |
|
23 |
if "problem" in st.query_params:
|
24 |
problem_id = int(st.query_params["problem"])
|
25 |
problem_instance = problem_dict[problem_id]
|
26 |
-
|
27 |
-
with st.container(border=True):
|
28 |
-
st.write(f"Problem [{problem_id}]")
|
29 |
|
30 |
with st.expander("Problem Description"):
|
31 |
st.markdown(problem_instance["question_content"])
|
@@ -63,6 +65,7 @@ else:
|
|
63 |
{
|
64 |
"problem_id": [int(problem['problem_id']) for problem in ds],
|
65 |
"difficulty": [str(problem['difficulty']) for problem in ds],
|
|
|
66 |
"problem_link": ["https://huggingface.co/spaces/Elfsong/CodeArena/?problem=" + str(problem['problem_id']) for problem in ds],
|
67 |
"acceptance_rate": [[random.randint(0, 100) for _ in range(20)] for problem in ds],
|
68 |
}
|
@@ -72,6 +75,7 @@ else:
|
|
72 |
column_config={
|
73 |
"problem_id": st.column_config.NumberColumn("Problem ID", width='small'),
|
74 |
"difficulty": st.column_config.TextColumn("Difficulty", width='small'),
|
|
|
75 |
"acceptance_rate": st.column_config.LineChartColumn("Acceptance Rate", y_min=0, y_max=100),
|
76 |
"problem_link": st.column_config.LinkColumn("Link", display_text="Open", width='small'),
|
77 |
},
|
|
|
13 |
|
14 |
with st.spinner("Loading data...", show_time=True):
|
15 |
problem_dict = dict()
|
16 |
+
|
17 |
+
# Leetcode Data
|
18 |
ds = load_dataset("Elfsong/leetcode_data", split='train')
|
19 |
for problem in ds:
|
20 |
+
problem_id = problem["title"]
|
21 |
+
problem['type'] = "leetcode"
|
22 |
problem_dict[problem_id] = problem
|
23 |
+
|
24 |
+
|
25 |
problem_count = len(problem_dict)
|
26 |
|
27 |
|
28 |
if "problem" in st.query_params:
|
29 |
problem_id = int(st.query_params["problem"])
|
30 |
problem_instance = problem_dict[problem_id]
|
|
|
|
|
|
|
31 |
|
32 |
with st.expander("Problem Description"):
|
33 |
st.markdown(problem_instance["question_content"])
|
|
|
65 |
{
|
66 |
"problem_id": [int(problem['problem_id']) for problem in ds],
|
67 |
"difficulty": [str(problem['difficulty']) for problem in ds],
|
68 |
+
"type": [str(problem['type']) for problem in ds],
|
69 |
"problem_link": ["https://huggingface.co/spaces/Elfsong/CodeArena/?problem=" + str(problem['problem_id']) for problem in ds],
|
70 |
"acceptance_rate": [[random.randint(0, 100) for _ in range(20)] for problem in ds],
|
71 |
}
|
|
|
75 |
column_config={
|
76 |
"problem_id": st.column_config.NumberColumn("Problem ID", width='small'),
|
77 |
"difficulty": st.column_config.TextColumn("Difficulty", width='small'),
|
78 |
+
"type": st.column_config.TextColumn("Type", width='small'),
|
79 |
"acceptance_rate": st.column_config.LineChartColumn("Acceptance Rate", y_min=0, y_max=100),
|
80 |
"problem_link": st.column_config.LinkColumn("Link", display_text="Open", width='small'),
|
81 |
},
|