JVice commited on
Commit
985480e
1 Parent(s): 04e2b14

updated to handle database inferencing

Browse files
Files changed (1) hide show
  1. user_evaluation_variables.py +23 -4
user_evaluation_variables.py CHANGED
@@ -1,6 +1,22 @@
1
  import yaml
2
  from yaml import safe_load
3
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  USERNAME = None
6
  EVAL_ID = None
@@ -52,6 +68,8 @@ def update_evaluation_table(evalType, debugging):
52
  global TIME
53
  global RUN_TIME
54
  global CURRENT_EVAL_TYPE
 
 
55
 
56
  if debugging:
57
  st.write("Username: ", USERNAME)
@@ -74,7 +92,7 @@ def update_evaluation_table(evalType, debugging):
74
 
75
  newEvaluationData = None
76
  if evalType == 'general':
77
- evalDataPath = './data/general_eval_database.yaml'
78
  newEvaluationData = {
79
  "Model": MODEL,
80
  "Model Type": MODEL_TYPE,
@@ -92,7 +110,7 @@ def update_evaluation_table(evalType, debugging):
92
  "Run Time": RUN_TIME
93
  }
94
  else:
95
- evalDataPath = './data/task_oriented_eval_database.yaml'
96
  newEvaluationData = {
97
  "Model": MODEL,
98
  "Model Type": MODEL_TYPE,
@@ -121,8 +139,9 @@ def update_evaluation_table(evalType, debugging):
121
  yamlData['evaluations']['username'][USERNAME][EVAL_ID] = newEvaluationData
122
 
123
  st.write("NEW DATABASE ", yamlData['evaluations']['username'][USERNAME])
124
- with open(evalDataPath, 'w') as yaml_file:
125
- yaml_file.write(yaml.dump(yamlData, default_flow_style=False))
 
126
 
127
  def reset_variables(evalType):
128
  global USERNAME
 
1
  import yaml
2
  from yaml import safe_load
3
  import streamlit as st
4
+ from pathlib import Path
5
+ from huggingface_hub import CommitScheduler, login
6
+
7
+ EVAL_DATABASE_DIR = Path("data")
8
+ EVAL_DATABASE_DIR.mkdir(parents=True, exist_ok=True)
9
+
10
+ GEN_EVAL_DATABASE_PATH = EVAL_DATABASE_DIR / f"general_eval_database.yaml"
11
+ TASK_EVAL_DATABASE_PATH = EVAL_DATABASE_DIR / f"task_oriented_eval_database.yaml"
12
+
13
+ EVAL_DATABASE_UPDATE_SCHEDULER = CommitScheduler(
14
+ repo_id="try-before-you-bias-data",
15
+ repo_type="dataset",
16
+ folder_path=EVAL_DATABASE_DIR,
17
+ path_in_repo="data",
18
+ every=3,
19
+ )
20
 
21
  USERNAME = None
22
  EVAL_ID = None
 
68
  global TIME
69
  global RUN_TIME
70
  global CURRENT_EVAL_TYPE
71
+ global GEN_EVAL_DATABASE_PATH
72
+ global TASK_EVAL_DATABASE_PATH
73
 
74
  if debugging:
75
  st.write("Username: ", USERNAME)
 
92
 
93
  newEvaluationData = None
94
  if evalType == 'general':
95
+ evalDataPath = GEN_EVAL_DATABASE_PATH
96
  newEvaluationData = {
97
  "Model": MODEL,
98
  "Model Type": MODEL_TYPE,
 
110
  "Run Time": RUN_TIME
111
  }
112
  else:
113
+ evalDataPath = TASK_EVAL_DATABASE_PATH
114
  newEvaluationData = {
115
  "Model": MODEL,
116
  "Model Type": MODEL_TYPE,
 
139
  yamlData['evaluations']['username'][USERNAME][EVAL_ID] = newEvaluationData
140
 
141
  st.write("NEW DATABASE ", yamlData['evaluations']['username'][USERNAME])
142
+ with EVAL_DATABASE_UPDATE_SCHEDULER.lock:
143
+ with open(evalDataPath, 'w') as yaml_file:
144
+ yaml_file.write(yaml.dump(yamlData, default_flow_style=False))
145
 
146
  def reset_variables(evalType):
147
  global USERNAME