forrestbao commited on
Commit
120684a
·
1 Parent(s): 8c3427d

fix bug in pulling results

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -1
  2. app/app_utils.py +9 -1
Dockerfile CHANGED
@@ -8,7 +8,9 @@ COPY ./app/app.py /app/app.py
8
  COPY ./app/app_utils.py /app/app_utils.py
9
  COPY ./app/results.json /app/results.json
10
 
11
- # RUN mkdir -p /app/results
 
 
12
 
13
  RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
14
 
 
8
  COPY ./app/app_utils.py /app/app_utils.py
9
  COPY ./app/results.json /app/results.json
10
 
11
+ RUN apt-get update && apt-get install -y git-lfs
12
+
13
+ RUN mkdir -p /app/results
14
 
15
  RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
16
 
app/app_utils.py CHANGED
@@ -86,7 +86,7 @@ def load_results(
86
 
87
  try:
88
  pull_results(results_dir)
89
- print ("Successfully pulled results from {results_dir}")
90
  except Exception as e:
91
  print(f"Failed to pull and/or extract latest results: {e}")
92
 
@@ -103,11 +103,19 @@ def load_results(
103
  print(f"Using pre-dumped results from {results_json}")
104
 
105
  results = json.load(open(results_json, "r"))
 
106
 
107
  results_df = pd.DataFrame(results)
108
  results_df = results_df.sort_values(by="Hallucination %", ascending=True)
 
 
 
 
109
  for column in ["Hallucination %", "Answer %", "Avg Summary Words"]:
110
  results_df[column] = results_df[column].apply(lambda x: round(x, 3))
 
 
 
111
 
112
  return results_df
113
 
 
86
 
87
  try:
88
  pull_results(results_dir)
89
+ print (f"Successfully pulled results from {results_dir}")
90
  except Exception as e:
91
  print(f"Failed to pull and/or extract latest results: {e}")
92
 
 
103
  print(f"Using pre-dumped results from {results_json}")
104
 
105
  results = json.load(open(results_json, "r"))
106
+ print(results)
107
 
108
  results_df = pd.DataFrame(results)
109
  results_df = results_df.sort_values(by="Hallucination %", ascending=True)
110
+
111
+ # replace any value TBD with 0
112
+ results_df = results_df.replace("TBD", -1)
113
+
114
  for column in ["Hallucination %", "Answer %", "Avg Summary Words"]:
115
  results_df[column] = results_df[column].apply(lambda x: round(x, 3))
116
+
117
+ # replace any value -1 with string "TBD"
118
+ results_df = results_df.replace(-1, "TBD")
119
 
120
  return results_df
121