arthrod commited on
Commit
82ac900
·
verified ·
1 Parent(s): d254c7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import json
3
  import uuid
4
  from datetime import datetime
5
  import os
 
6
 
7
  class LegalTechEvaluator:
8
  def __init__(self):
@@ -17,19 +18,23 @@ class LegalTechEvaluator:
17
  """Automatically load test_legal_tech.jsonl if it exists"""
18
  if os.path.exists("test_legal_tech.jsonl"):
19
  self.load_from_file("test_legal_tech.jsonl")
 
20
  return True
 
21
  return False
22
 
23
  def load_from_file(self, filename):
24
  """Load data from JSONL file"""
25
  self.data = []
26
  try:
27
- with open(filename, 'r') as f:
28
  for line in f:
29
  self.data.append(json.loads(line))
 
30
  return True
31
  except Exception as e:
32
  print(f"Error loading file: {e}")
 
33
  return False
34
 
35
  def create_user_session(self, name):
@@ -45,6 +50,7 @@ class LegalTechEvaluator:
45
  "completed": False
46
  }
47
  self.current_index = 0
 
48
  return user_id
49
 
50
  def record_choice(self, sample_choice):
@@ -56,6 +62,7 @@ class LegalTechEvaluator:
56
  "timestamp": datetime.now().isoformat()
57
  }
58
  return True
 
59
  return False
60
 
61
  def get_current_question(self):
 
3
  import uuid
4
  from datetime import datetime
5
  import os
6
+ from loguru import logger
7
 
8
  class LegalTechEvaluator:
9
  def __init__(self):
 
18
  """Automatically load test_legal_tech.jsonl if it exists"""
19
  if os.path.exists("test_legal_tech.jsonl"):
20
  self.load_from_file("test_legal_tech.jsonl")
21
+ logger.info("found")
22
  return True
23
+ logger.info("not found")
24
  return False
25
 
26
  def load_from_file(self, filename):
27
  """Load data from JSONL file"""
28
  self.data = []
29
  try:
30
+ with open("test_legal_tech.jsonl", 'r') as f:
31
  for line in f:
32
  self.data.append(json.loads(line))
33
+ logger.info("loaded")
34
  return True
35
  except Exception as e:
36
  print(f"Error loading file: {e}")
37
+ logger.info("failed to load")
38
  return False
39
 
40
  def create_user_session(self, name):
 
50
  "completed": False
51
  }
52
  self.current_index = 0
53
+ logger.info("new session created")
54
  return user_id
55
 
56
  def record_choice(self, sample_choice):
 
62
  "timestamp": datetime.now().isoformat()
63
  }
64
  return True
65
+ logger.info("choice recorded")
66
  return False
67
 
68
  def get_current_question(self):