Ashmi Banerjee commited on
Commit
c7dea7e
·
1 Parent(s): 0759822

update data

Browse files
Files changed (2) hide show
  1. README.md +5 -4
  2. app.py +17 -2
README.md CHANGED
@@ -21,10 +21,11 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
21
  [ ] Make sure each question has at least 10 responses
22
 
23
  ### TODO List (Human Eval)
24
- [ ] Check if user_id in database, then resume where they left off
25
- [ ] Implement save and continue later button
26
  [ ] Implement questions with proper buttons (with text)
27
  [ ] Back button
28
- [ ] Dataset linking
29
  [ ] prettify the context field with new lines and highlighting popularity etc. keywords in bold
30
- [ ] Doing it for two models
 
 
21
  [ ] Make sure each question has at least 10 responses
22
 
23
  ### TODO List (Human Eval)
24
+ [x] Check if user_id in database, then resume where they left off
25
+ [x] Implement save and continue later button
26
  [ ] Implement questions with proper buttons (with text)
27
  [ ] Back button
28
+ [ ] Dataset linking HF
29
  [ ] prettify the context field with new lines and highlighting popularity etc. keywords in bold
30
+ [ ] Doing it for two models
31
+ [ ] Add check for ratings should not be 0 for Exit & Resume Later
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import json
2
  from typing import Dict
3
 
 
 
4
  from db.schema import Feedback, Response
5
  from db.crud import ingest, read, save_feedback
6
  import pandas as pd
@@ -79,14 +81,27 @@ def exit_screen():
79
  def reset_survey():
80
  """Reset the survey state to start over."""
81
  st.session_state.responses = []
82
- st.session_state.completed = True #TODO: Change to False?
83
  st.session_state.start_new_survey = True
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  def ui():
87
  """Main function to control the survey flow."""
88
  custom_css()
89
- data = pd.read_csv("data/gemini_results_subset.csv")[:5]
90
  initialization()
91
 
92
  if st.session_state.completed and not st.session_state.start_new_survey:
 
1
  import json
2
  from typing import Dict
3
 
4
+ from datasets import load_dataset
5
+
6
  from db.schema import Feedback, Response
7
  from db.crud import ingest, read, save_feedback
8
  import pandas as pd
 
81
  def reset_survey():
82
  """Reset the survey state to start over."""
83
  st.session_state.responses = []
84
+ st.session_state.completed = True
85
  st.session_state.start_new_survey = True
86
 
87
+ def load_data():
88
+ try:
89
+ data = pd.read_csv("data/gemini_results_subset.csv")[:5]
90
+ return data
91
+ except Exception as e:
92
+ repo_name = os.getenv("DATA_REPO")
93
+ data_files = os.getenv("LLAMA_DATA_FILES")
94
+ HF_TOKEN = os.getenv("HF_TOKEN")
95
+ dataset = load_dataset(repo_name, token=True, data_files=data_files)
96
+ dataset.set_format(type='pandas') ## converting it into pandas
97
+ df = dataset["train"][:]
98
+ return df[:5]
99
+
100
 
101
  def ui():
102
  """Main function to control the survey flow."""
103
  custom_css()
104
+ data = load_data()
105
  initialization()
106
 
107
  if st.session_state.completed and not st.session_state.start_new_survey: