Spaces:
Sleeping
Sleeping
Upload import_locally_stored_tts_model_files.py
Browse files
import_locally_stored_tts_model_files.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
|
| 4 |
+
print("Importing locally stored coqui tts models...")
|
| 5 |
+
|
| 6 |
+
# Define the source directory and the destination base path
|
| 7 |
+
source_dir = os.getcwd() # Current working directory
|
| 8 |
+
tts_folder = os.path.join(source_dir, 'Base_XTTS_Model')
|
| 9 |
+
destination_base = '/home/user/.local/share/'
|
| 10 |
+
|
| 11 |
+
# Define the destination path for the tts folder
|
| 12 |
+
destination_path = os.path.join(destination_base, 'tts')
|
| 13 |
+
|
| 14 |
+
# Move the entire tts folder
|
| 15 |
+
if os.path.exists(tts_folder):
|
| 16 |
+
# Remove the destination folder if it exists
|
| 17 |
+
if os.path.exists(destination_path):
|
| 18 |
+
shutil.rmtree(destination_path) # Remove the existing folder
|
| 19 |
+
shutil.move(tts_folder, destination_path)
|
| 20 |
+
print(f'Moved: {tts_folder} to {destination_path}')
|
| 21 |
+
print("Locally stored base coqui XTTS tts model imported!")
|
| 22 |
+
print(os.listdir('/home/user/.local/share/tts'))
|
| 23 |
+
else:
|
| 24 |
+
print(f'Source path does not exist: {tts_folder}')
|