Spaces:
Sleeping
Sleeping
drewThomasson
commited on
Upload 3 files
Browse files
ebook2audiobookXTTS/import_all_files.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import import_nltk_files
|
2 |
+
|
3 |
+
import import_locally_stored_tts_model_files
|
4 |
+
|
5 |
+
#import download_tos_agreed_file
|
ebook2audiobookXTTS/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}')
|
ebook2audiobookXTTS/import_nltk_files.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import shutil
|
2 |
+
import os
|
3 |
+
|
4 |
+
try:
|
5 |
+
print("Importing nltk files...")
|
6 |
+
|
7 |
+
# Define source and destination paths
|
8 |
+
source_folder = '/home/user/app/nltk_data'
|
9 |
+
destination_folder = '/home/user/nltk_data'
|
10 |
+
|
11 |
+
# Ensure the destination folder exists, create if it doesn't
|
12 |
+
os.makedirs(destination_folder, exist_ok=True)
|
13 |
+
|
14 |
+
# Move the source folder to the destination
|
15 |
+
shutil.move(source_folder, destination_folder)
|
16 |
+
|
17 |
+
print(f"NLTK folder moved to {destination_folder}")
|
18 |
+
|
19 |
+
except FileNotFoundError as fnf_error:
|
20 |
+
print(f"Error: Source folder not found. {fnf_error}")
|
21 |
+
except PermissionError as perm_error:
|
22 |
+
print(f"Error: Permission denied. {perm_error}")
|
23 |
+
except Exception as e:
|
24 |
+
print(f"An unexpected error occurred: {e}")
|