Spaces:
Runtime error
Runtime error
Download file_processing.py from Lambang0902/Test-Space: direct link, hf CLI and curl.
- Browser
- Download file 438 Bytes
-
https://huggingface.co/spaces/Lambang0902/Test-Space/resolve/main/file_processing.py
- Command line
-
hf download hf://spaces/Lambang0902/Test-Space/file_processing.py
-
curl -L -o file_processing.py https://huggingface.co/spaces/Lambang0902/Test-Space/resolve/main/file_processing.py
438 Bytes
| import zipfile | |
| class FileProcess: | |
| ALLOWED_EXTENSIONS = {'zip'} | |
| def allowed_file(filename): | |
| return '.' in filename and \ | |
| filename.rsplit('.', 1)[1].lower() in FileProcess.ALLOWED_EXTENSIONS | |
| def extract_zip(filepath): | |
| path_ke_folder = './static/dataset/' | |
| with zipfile.ZipFile(filepath, 'r') as zip_ref: | |
| zip_ref.extractall(path_ke_folder) | |