Spaces:
Sleeping
Sleeping
List files in downloaded dir
Browse files- mgr_sentences.py +8 -0
mgr_sentences.py
CHANGED
|
@@ -31,6 +31,12 @@ def retrieveAllSaved():
|
|
| 31 |
|
| 32 |
return repo_files
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
def store_group_sentences(filename: str, df):
|
| 35 |
DATA_FILENAME_1 = f"{filename}"
|
| 36 |
LOCAL_PATH_FILE = os.path.join(LOCAL_SAVE_DIRNAME, DATA_FILENAME_1)
|
|
@@ -94,6 +100,8 @@ def get_sentence_csv(file_path: str):
|
|
| 94 |
except Exception as e:
|
| 95 |
# file not found
|
| 96 |
print(f"file not found, probably: {e}")
|
|
|
|
|
|
|
| 97 |
|
| 98 |
ds_local_path = os.path.join(LOCAL_DATA_DIRNAME,
|
| 99 |
"datasets--AnimaLab--bias-test-gpt-sentences",
|
|
|
|
| 31 |
|
| 32 |
return repo_files
|
| 33 |
|
| 34 |
+
def list_files(directory):
|
| 35 |
+
"""List all files in a given directory and its subdirectories."""
|
| 36 |
+
for root, _, files in os.walk(directory):
|
| 37 |
+
for file in files:
|
| 38 |
+
print(os.path.join(root, file))
|
| 39 |
+
|
| 40 |
def store_group_sentences(filename: str, df):
|
| 41 |
DATA_FILENAME_1 = f"{filename}"
|
| 42 |
LOCAL_PATH_FILE = os.path.join(LOCAL_SAVE_DIRNAME, DATA_FILENAME_1)
|
|
|
|
| 100 |
except Exception as e:
|
| 101 |
# file not found
|
| 102 |
print(f"file not found, probably: {e}")
|
| 103 |
+
directory_path = LOCAL_DATA_DIRNAME
|
| 104 |
+
list_files(directory_path)
|
| 105 |
|
| 106 |
ds_local_path = os.path.join(LOCAL_DATA_DIRNAME,
|
| 107 |
"datasets--AnimaLab--bias-test-gpt-sentences",
|