Spaces:
Running
Running
drewThomasson
commited on
Create import_local_tts_models
Browse files- import_local_tts_models +22 -0
import_local_tts_models
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import shutil
|
3 |
+
|
4 |
+
# Define source and destination directories
|
5 |
+
source_dir = 'tts_models'
|
6 |
+
destination_dir = '/home/user/.local/share/tts/'
|
7 |
+
|
8 |
+
# Create destination directory if it doesn't exist
|
9 |
+
os.makedirs(destination_dir, exist_ok=True)
|
10 |
+
|
11 |
+
# Copy all contents from source to destination
|
12 |
+
for item in os.listdir(source_dir):
|
13 |
+
source_path = os.path.join(source_dir, item)
|
14 |
+
destination_path = os.path.join(destination_dir, item)
|
15 |
+
|
16 |
+
# Copy files or directories
|
17 |
+
if os.path.isdir(source_path):
|
18 |
+
shutil.copytree(source_path, destination_path, dirs_exist_ok=True)
|
19 |
+
else:
|
20 |
+
shutil.copy2(source_path, destination_path)
|
21 |
+
|
22 |
+
print("Contents copied successfully.")
|