Spaces:
Sleeping
Sleeping
Feat: Add backup files
Browse files- load_and_save.py +5 -0
load_and_save.py
CHANGED
|
@@ -9,6 +9,7 @@ from mutagen.wave import WAVE
|
|
| 9 |
import json
|
| 10 |
from text_explanations import *
|
| 11 |
from utils import *
|
|
|
|
| 12 |
|
| 13 |
possible_ids = {'Tiger-001': 0, 'Falcon-002': 0,
|
| 14 |
'Elephant-003': 1, 'Panther-004': 1,
|
|
@@ -138,6 +139,10 @@ def save_annotation(annotations_df, file_list_df, emotions, confidence, comments
|
|
| 138 |
annotations_df.loc[len(annotations_df)] = [sample_id, sentence, emotions, confidence, comments, n_clicks]
|
| 139 |
ann_completed += 1
|
| 140 |
annotations_df.to_csv(f"{persistent_storage}/{participant_id}_annotations.csv", index=False) # Save to a CSV file
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
return annotations_df, ann_completed
|
| 143 |
|
|
|
|
| 9 |
import json
|
| 10 |
from text_explanations import *
|
| 11 |
from utils import *
|
| 12 |
+
from datetime import datetime
|
| 13 |
|
| 14 |
possible_ids = {'Tiger-001': 0, 'Falcon-002': 0,
|
| 15 |
'Elephant-003': 1, 'Panther-004': 1,
|
|
|
|
| 139 |
annotations_df.loc[len(annotations_df)] = [sample_id, sentence, emotions, confidence, comments, n_clicks]
|
| 140 |
ann_completed += 1
|
| 141 |
annotations_df.to_csv(f"{persistent_storage}/{participant_id}_annotations.csv", index=False) # Save to a CSV file
|
| 142 |
+
|
| 143 |
+
timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
|
| 144 |
+
|
| 145 |
+
annotations_df.to_csv(f"{persistent_storage}/temp/{participant_id}_annotations_{timestamp}.csv", index=False) # Save to a CSV file
|
| 146 |
|
| 147 |
return annotations_df, ann_completed
|
| 148 |
|