Spaces:
Sleeping
Sleeping
Update src/my_utils.py
Browse files- src/my_utils.py +8 -0
src/my_utils.py
CHANGED
|
@@ -22,6 +22,14 @@ def load_audio(file, sr):
|
|
| 22 |
|
| 23 |
return np.frombuffer(out, np.float32).flatten()
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
def show_stored_files(root_dir):
|
| 26 |
for entry in os.listdir(root_dir):
|
| 27 |
full_path = os.path.join(root_dir, entry)
|
|
|
|
| 22 |
|
| 23 |
return np.frombuffer(out, np.float32).flatten()
|
| 24 |
|
| 25 |
+
def remove_files_and_folders(folder_path):
|
| 26 |
+
print("Cleaning gradio cache ...")
|
| 27 |
+
try:
|
| 28 |
+
shutil.rmtree(folder_path)
|
| 29 |
+
print(f"All files and folders inside {folder_path} have been removed.")
|
| 30 |
+
except Exception as e:
|
| 31 |
+
print(f"An error occurred: {e}")
|
| 32 |
+
|
| 33 |
def show_stored_files(root_dir):
|
| 34 |
for entry in os.listdir(root_dir):
|
| 35 |
full_path = os.path.join(root_dir, entry)
|