rohan13 commited on
Commit
1cc9d33
1 Parent(s): 8d7b187

Minor bug fixes

Browse files
Files changed (2) hide show
  1. app.py +1 -9
  2. grader.py +1 -0
app.py CHANGED
@@ -28,6 +28,7 @@ grader_qa = None
28
 
29
  def add_text(history, text):
30
  print("Question asked: " + text)
 
31
  response = run_model(text)
32
  history = history + [(text, response)]
33
  print(history)
@@ -38,15 +39,6 @@ def run_model(text):
38
  global grader, grader_qa
39
  start_time = time.time()
40
  print("start time:" + str(start_time))
41
- if not grader_qa and not grader:
42
- if os.path.isfile(pickle_file) and os.path.isfile(index_file) and os.path.getsize(
43
- pickle_file) > 0 and os.path.isfile('docs/discussion_entries.json') and os.path.isfile(
44
- 'docs/rubric-data.json') > 0:
45
- grader = Grader(qa_model)
46
- grader_qa = GraderQA(grader, embeddings)
47
- elif not grader_qa:
48
- grader.llm.model_name = qa_model
49
- grader_qa = GraderQA(grader, embeddings)
50
  response = grader_qa.chain(text)
51
  sources = []
52
  for document in response['source_documents']:
 
28
 
29
  def add_text(history, text):
30
  print("Question asked: " + text)
31
+ get_grading_status(history)
32
  response = run_model(text)
33
  history = history + [(text, response)]
34
  print(history)
 
39
  global grader, grader_qa
40
  start_time = time.time()
41
  print("start time:" + str(start_time))
 
 
 
 
 
 
 
 
 
42
  response = grader_qa.chain(text)
43
  sources = []
44
  for document in response['source_documents']:
grader.py CHANGED
@@ -72,6 +72,7 @@ class Grader:
72
  rubric_text.append(f"description:{r['description']}\n" + "\n".join(
73
  [f"points:{rating['points']} points: {rating['description']}" for rating in r['ratings']]))
74
  elif 'points_possible' in r:
 
75
  print("added points_possible")
76
  elif 'title' in r: # Check if title exists in rubric
77
  self.title = r['title'] # Save title for later use
 
72
  rubric_text.append(f"description:{r['description']}\n" + "\n".join(
73
  [f"points:{rating['points']} points: {rating['description']}" for rating in r['ratings']]))
74
  elif 'points_possible' in r:
75
+ rubric_text.append(f"points_possible:{r['points_possible']}")
76
  print("added points_possible")
77
  elif 'title' in r: # Check if title exists in rubric
78
  self.title = r['title'] # Save title for later use