Spaces:
Sleeping
Sleeping
Fix: Attempt to fix error with last index; Add new id
Browse files
__pycache__/load_and_save.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/load_and_save.cpython-310.pyc and b/__pycache__/load_and_save.cpython-310.pyc differ
|
|
|
__pycache__/text_explanations.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/text_explanations.cpython-310.pyc and b/__pycache__/text_explanations.cpython-310.pyc differ
|
|
|
__pycache__/utils.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
|
|
|
app.py
CHANGED
|
@@ -133,9 +133,9 @@ with (gr.Blocks(theme=gr.themes.Soft(), css = css) as demo):
|
|
| 133 |
# Go to the next example
|
| 134 |
next_button.click(
|
| 135 |
next_example,
|
| 136 |
-
inputs=[annotations, file_list,emotions, confidence, comments, n_clicks, participant_id, ann_completed, current_index],
|
| 137 |
outputs=[annotations,sentence_text, audio_player, emotions, confidence, comments, n_clicks, start, end, duration, ann_completed,
|
| 138 |
-
current_index],).then(state_to_number,
|
| 139 |
[start_temp, end_temp, duration_temp, current_index_temp, ann_completed_temp, total_temp]).then(None, [],
|
| 140 |
[start_temp, end_temp, duration_temp, current_index_temp,
|
| 141 |
ann_completed_temp, total_temp], js = js_progress_bar)
|
|
|
|
| 133 |
# Go to the next example
|
| 134 |
next_button.click(
|
| 135 |
next_example,
|
| 136 |
+
inputs=[annotations, file_list,emotions, confidence, comments, n_clicks, participant_id, start, end, duration, ann_completed, current_index],
|
| 137 |
outputs=[annotations,sentence_text, audio_player, emotions, confidence, comments, n_clicks, start, end, duration, ann_completed,
|
| 138 |
+
current_index],).then(state_to_number, [start, end, duration, current_index, ann_completed, total],
|
| 139 |
[start_temp, end_temp, duration_temp, current_index_temp, ann_completed_temp, total_temp]).then(None, [],
|
| 140 |
[start_temp, end_temp, duration_temp, current_index_temp,
|
| 141 |
ann_completed_temp, total_temp], js = js_progress_bar)
|
load_and_save.py
CHANGED
|
@@ -18,7 +18,8 @@ possible_ids = {'Tiger-001': 0, 'Falcon-002': 0,
|
|
| 18 |
'Leopard-009': 4, 'Panda-010': 4,
|
| 19 |
'Cheetah-011': 5, 'Gorilla-012': 5,
|
| 20 |
'Dolphin-013' : 6, 'Lynx-014': 6,
|
| 21 |
-
'Moose-015': 7, 'Raccoon-016': 7
|
|
|
|
| 22 |
|
| 23 |
persistent_storage = Path('/data')
|
| 24 |
password_files = os.getenv("password_files")
|
|
@@ -146,7 +147,7 @@ def save_annotation(annotations_df, file_list_df, emotions, confidence, comments
|
|
| 146 |
|
| 147 |
return annotations_df, ann_completed
|
| 148 |
|
| 149 |
-
def next_example(annotations_df, file_list_df, emotions, confidence, comments, n_clicks, participant_id, ann_completed, current_index):
|
| 150 |
"""Move to the next example.
|
| 151 |
|
| 152 |
Parameters:
|
|
@@ -185,12 +186,13 @@ def next_example(annotations_df, file_list_df, emotions, confidence, comments, n
|
|
| 185 |
annotations_df, ann_completed = save_annotation(annotations_df, file_list_df, emotions, confidence, comments, n_clicks, participant_id, ann_completed, current_index)
|
| 186 |
if current_index < len(file_list_df):
|
| 187 |
current_index += 1
|
|
|
|
| 188 |
|
| 189 |
else:
|
| 190 |
gr.Warning("This is the last example, well done!")
|
| 191 |
print(f'current_index {current_index}')
|
| 192 |
-
|
| 193 |
-
return annotations_df,
|
| 194 |
|
| 195 |
def previous_example(annotations_df, file_list_df, emotion, confidence, comments, n_clicks, participant_id, ann_completed, current_index):
|
| 196 |
|
|
@@ -224,6 +226,7 @@ def previous_example(annotations_df, file_list_df, emotion, confidence, comments
|
|
| 224 |
|
| 225 |
if emotion != "Blank":
|
| 226 |
annotations_df, ann_completed = save_annotation(annotations_df, file_list_df, emotion, confidence, comments, n_clicks, participant_id, ann_completed, current_index)
|
|
|
|
| 227 |
if current_index > 0:
|
| 228 |
current_index -= 1
|
| 229 |
|
|
|
|
| 18 |
'Leopard-009': 4, 'Panda-010': 4,
|
| 19 |
'Cheetah-011': 5, 'Gorilla-012': 5,
|
| 20 |
'Dolphin-013' : 6, 'Lynx-014': 6,
|
| 21 |
+
'Moose-015': 7, 'Raccoon-016': 7,
|
| 22 |
+
'Rabbit-017': 0}
|
| 23 |
|
| 24 |
persistent_storage = Path('/data')
|
| 25 |
password_files = os.getenv("password_files")
|
|
|
|
| 147 |
|
| 148 |
return annotations_df, ann_completed
|
| 149 |
|
| 150 |
+
def next_example(annotations_df, file_list_df, emotions, confidence, comments, n_clicks, participant_id, start, end, duration, ann_completed, current_index):
|
| 151 |
"""Move to the next example.
|
| 152 |
|
| 153 |
Parameters:
|
|
|
|
| 186 |
annotations_df, ann_completed = save_annotation(annotations_df, file_list_df, emotions, confidence, comments, n_clicks, participant_id, ann_completed, current_index)
|
| 187 |
if current_index < len(file_list_df):
|
| 188 |
current_index += 1
|
| 189 |
+
sentence, audio_path, emotion, confidence, comments, n_clicks, start, end, duration = load_example(annotations_df, file_list_df, current_index)
|
| 190 |
|
| 191 |
else:
|
| 192 |
gr.Warning("This is the last example, well done!")
|
| 193 |
print(f'current_index {current_index}')
|
| 194 |
+
|
| 195 |
+
return annotations_df, sentence, audio_path, emotion, confidence, comments, n_clicks, start, end, duration, ann_completed, current_index
|
| 196 |
|
| 197 |
def previous_example(annotations_df, file_list_df, emotion, confidence, comments, n_clicks, participant_id, ann_completed, current_index):
|
| 198 |
|
|
|
|
| 226 |
|
| 227 |
if emotion != "Blank":
|
| 228 |
annotations_df, ann_completed = save_annotation(annotations_df, file_list_df, emotion, confidence, comments, n_clicks, participant_id, ann_completed, current_index)
|
| 229 |
+
|
| 230 |
if current_index > 0:
|
| 231 |
current_index -= 1
|
| 232 |
|