Spaces:
Build error
Build error
| import zipfile | |
| import os | |
| def extract_zip(zip_file, extract_to): | |
| with zipfile.ZipFile(zip_file, 'r') as zip_ref: | |
| zip_ref.extractall(extract_to) | |
| def read_texts_from_folder(folder_path): | |
| texts = [] | |
| for root, _, files in os.walk(folder_path): | |
| for file in files: | |
| if file.endswith(".txt"): | |
| with open(os.path.join(root, file), 'r', encoding='utf-8') as f: | |
| texts.append(f.read()) | |
| return texts | |