Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -202,8 +202,7 @@ def get_start_index():
|
|
| 202 |
return -2
|
| 203 |
|
| 204 |
def read_data():
|
| 205 |
-
|
| 206 |
-
with hf_fs.open(input_repo_path + '/' + to_annotate_file_name.format(batch=st.session_state.batch)) as f:
|
| 207 |
return pd.read_csv(f)
|
| 208 |
|
| 209 |
def read_saved_data():
|
|
@@ -224,7 +223,7 @@ def save_data(data):
|
|
| 224 |
f.write(json.dumps(data))
|
| 225 |
|
| 226 |
def get_base_path():
|
| 227 |
-
return f"{st.session_state.
|
| 228 |
|
| 229 |
def get_path():
|
| 230 |
return f"{get_base_path()}/{st.session_state.current_index}.json"
|
|
@@ -426,7 +425,6 @@ def prep_and_save_data(index, skip_sample):
|
|
| 426 |
save_data({
|
| 427 |
'user_id': st.session_state.user_id,
|
| 428 |
'index': st.session_state.current_index,
|
| 429 |
-
'batch': st.session_state.batch,
|
| 430 |
**(st.session_state.data.iloc[index][COLS_TO_SAVE].to_dict() if 0 <= index < len(st.session_state.data) else {}),
|
| 431 |
**{k: st.session_state[k + str(index)] for k in st.session_state.data_inputs_keys},
|
| 432 |
'skip': skip_sample
|
|
@@ -473,7 +471,7 @@ if 'unacceptable_response' in st.session_state and st.session_state.unacceptable
|
|
| 473 |
st.stop()
|
| 474 |
|
| 475 |
# batch-specific data subset
|
| 476 |
-
st.session_state.batch = get_param_from_url("batch")
|
| 477 |
|
| 478 |
# Load the data to annotate
|
| 479 |
if 'data' not in st.session_state:
|
|
|
|
| 202 |
return -2
|
| 203 |
|
| 204 |
def read_data():
|
| 205 |
+
with hf_fs.open(input_repo_path + '/' + to_annotate_file_name) as f:
|
|
|
|
| 206 |
return pd.read_csv(f)
|
| 207 |
|
| 208 |
def read_saved_data():
|
|
|
|
| 223 |
f.write(json.dumps(data))
|
| 224 |
|
| 225 |
def get_base_path():
|
| 226 |
+
return f"{st.session_state.user_id}"
|
| 227 |
|
| 228 |
def get_path():
|
| 229 |
return f"{get_base_path()}/{st.session_state.current_index}.json"
|
|
|
|
| 425 |
save_data({
|
| 426 |
'user_id': st.session_state.user_id,
|
| 427 |
'index': st.session_state.current_index,
|
|
|
|
| 428 |
**(st.session_state.data.iloc[index][COLS_TO_SAVE].to_dict() if 0 <= index < len(st.session_state.data) else {}),
|
| 429 |
**{k: st.session_state[k + str(index)] for k in st.session_state.data_inputs_keys},
|
| 430 |
'skip': skip_sample
|
|
|
|
| 471 |
st.stop()
|
| 472 |
|
| 473 |
# batch-specific data subset
|
| 474 |
+
#st.session_state.batch = get_param_from_url("batch")
|
| 475 |
|
| 476 |
# Load the data to annotate
|
| 477 |
if 'data' not in st.session_state:
|