Elfsong commited on
Commit
83b66cb
·
1 Parent(s): 4395c46
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -5,15 +5,19 @@ from datasets import load_dataset
5
 
6
  st.title("Code Arena")
7
 
 
 
 
 
 
 
 
 
8
  if "problem" in st.query_params:
9
  problem_id = st.query_params["problem"]
10
  st.write(f"Problem Description - [{problem_id}]")
11
- with st.spinner("Loading data...", show_time=True):
12
- ds = load_dataset("Elfsong/leetcode_data", split='train')
13
-
14
- if st.button("Back"):
15
- del st.query_params['problem']
16
-
17
  else:
18
  with st.spinner("Loading data...", show_time=True):
19
  ds = load_dataset("Elfsong/leetcode_data", split='train')
 
5
 
6
  st.title("Code Arena")
7
 
8
+ with st.spinner("Loading data...", show_time=True):
9
+ problem_dict = dict()
10
+ ds = load_dataset("Elfsong/leetcode_data", split='train')
11
+ for problem in ds:
12
+ problem_id = problem["problem_id"]
13
+ problem_dict[problem_id] = problem
14
+
15
+
16
  if "problem" in st.query_params:
17
  problem_id = st.query_params["problem"]
18
  st.write(f"Problem Description - [{problem_id}]")
19
+ st.write(problem_dict[problem_id])
20
+
 
 
 
 
21
  else:
22
  with st.spinner("Loading data...", show_time=True):
23
  ds = load_dataset("Elfsong/leetcode_data", split='train')