deema commited on
Commit
3b53056
1 Parent(s): cc0fd9e
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -9,6 +9,7 @@ import os
9
  import sys
10
  from database import save_response
11
 
 
12
  css = """
13
  .rtl{
14
  text-align: right;
@@ -25,6 +26,7 @@ df = pd.read_json(file_path, orient='records', lines=False)
25
  question_count = {index: 0 for index in df.index}
26
  model_rankings = defaultdict(lambda: {'1st': 0, '2nd': 0, '3rd': 0})
27
 
 
28
  def get_rank_suffix(rank):
29
  if 11 <= rank <= 13:
30
  return 'th'
@@ -32,6 +34,7 @@ def get_rank_suffix(rank):
32
  suffixes = {1: 'st', 2: 'nd', 3: 'rd'}
33
  return suffixes.get(rank % 10, 'th')
34
 
 
35
  def process_rankings(user_rankings):
36
  print("Processing Rankings:", user_rankings) # Debugging print
37
  for answer_id, rank in user_rankings:
@@ -49,6 +52,7 @@ def process_rankings(user_rankings):
49
  print("Updated Model Rankings:", model_rankings) # Debugging print
50
  return
51
 
 
52
  def get_questions_and_answers():
53
  available_questions = [index for index, count in question_count.items() if count < 3]
54
  selected_indexes = random.sample(available_questions, min(4, len(available_questions)))
@@ -68,6 +72,7 @@ def get_questions_and_answers():
68
 
69
  return questions_and_answers
70
 
 
71
  def rank_interface():
72
  questions = get_questions_and_answers()
73
 
 
9
  import sys
10
  from database import save_response
11
 
12
+
13
  css = """
14
  .rtl{
15
  text-align: right;
 
26
  question_count = {index: 0 for index in df.index}
27
  model_rankings = defaultdict(lambda: {'1st': 0, '2nd': 0, '3rd': 0})
28
 
29
+
30
  def get_rank_suffix(rank):
31
  if 11 <= rank <= 13:
32
  return 'th'
 
34
  suffixes = {1: 'st', 2: 'nd', 3: 'rd'}
35
  return suffixes.get(rank % 10, 'th')
36
 
37
+
38
  def process_rankings(user_rankings):
39
  print("Processing Rankings:", user_rankings) # Debugging print
40
  for answer_id, rank in user_rankings:
 
52
  print("Updated Model Rankings:", model_rankings) # Debugging print
53
  return
54
 
55
+
56
  def get_questions_and_answers():
57
  available_questions = [index for index, count in question_count.items() if count < 3]
58
  selected_indexes = random.sample(available_questions, min(4, len(available_questions)))
 
72
 
73
  return questions_and_answers
74
 
75
+
76
  def rank_interface():
77
  questions = get_questions_and_answers()
78