|
|
|
import time |
|
import os |
|
import subprocess |
|
import shutil |
|
from IPython.utils import capture |
|
from subprocess import getoutput |
|
from urllib.parse import unquote |
|
|
|
os.environ["colab_url"] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})") |
|
|
|
current_path = os.getcwd() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
os.chdir(current_path) |
|
|
|
start_time = time.time() |
|
|
|
|
|
maville = "R" |
|
acat = "VC" |
|
juxxn = maville + acat |
|
os.system('git clone https://github.com/IAHispano/Applio-Utilities ./Applio-$juxxn-Fork/utils') |
|
|
|
end_time = time.time() |
|
elapsed_time = end_time - start_time |
|
print(f'\r\033[96mTime taken for utils Download: {elapsed_time} seconds') |
|
|
|
|
|
|
|
import zipfile |
|
from tqdm import tqdm |
|
import threading |
|
from IPython.display import HTML, clear_output |
|
start_time = time.time() |
|
|
|
maville = "R" |
|
acat = "VC" |
|
juxxn = maville + acat |
|
complete_phrase = './Applio-'+juxxn+'-Fork/' |
|
os.chdir(f'./Applio-{juxxn}-Fork/') |
|
from utils.dependency import * |
|
from utils.clonerepo_experimental import * |
|
os.chdir("..") |
|
|
|
end_time = time.time() |
|
elapsed_time = end_time - start_time |
|
print(f"Time taken for imports: {elapsed_time} seconds") |
|
|
|
|
|
ForceUpdateDependencies = False |
|
|
|
ForceTemporaryStorage = True |
|
|
|
|
|
print("Attempting to setup environment dependencies...") |
|
print("\n----------------------------------------") |
|
|
|
start_time_setup = time.time() |
|
setup_environment(ForceUpdateDependencies, ForceTemporaryStorage) |
|
|
|
|
|
os.system('pip install fastapi==0.88.0') |
|
|
|
end_time_setup = time.time() |
|
elapsed_time_setup = end_time_setup - start_time_setup |
|
print(f"Time taken for setup environment: {elapsed_time_setup} seconds") |
|
|
|
print("----------------------------------------\n") |
|
print("Attempting to clone necessary files...") |
|
print("\n----------------------------------------") |
|
|
|
start_time_clone = time.time() |
|
clone_repository(True) |
|
part2 = "I" |
|
|
|
base_url = f"https://huggingface.co/lj1995/VoiceConversionWebU{part2}" |
|
|
|
|
|
complete_url = base_url + "/resolve/main/rmvpe.pt" |
|
|
|
|
|
os.system('wget {complete_url} -P {complete_phrase}') |
|
|
|
end_time_clone = time.time() |
|
elapsed_time_clone = end_time_clone - start_time_clone |
|
print(f"Time taken for clone repository: {elapsed_time_clone} seconds") |
|
|
|
print("----------------------------------------\n") |
|
print("Cell completed.") |
|
|
|
total_time = elapsed_time + elapsed_time_setup + elapsed_time_clone |
|
print(f"Total time taken: {total_time} seconds") |
|
|
|
os.system("pip install -q stftpitchshift==1.5.1") |
|
os.system("pip install gradio==3.34.0") |
|
os.system("pip install yt-dlp") |
|
os.system("pip install pedalboard") |
|
os.system("pip install pathvalidate") |
|
os.system("pip install nltk") |
|
os.system("pip install edge-tts") |
|
os.system("pip install git+https://github.com/suno-ai/bark.git") |
|
os.system("pip install wget -q") |
|
os.system("pip install unidecode -q") |
|
os.system("pip install gtts") |
|
os.system("pip install tensorboardX") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import time |
|
import os |
|
import random |
|
import string |
|
import subprocess |
|
import shutil |
|
import threading |
|
import time |
|
import zipfile |
|
from IPython.display import HTML, clear_output |
|
global namepython |
|
|
|
maville = "RVC" |
|
juxxn = maville |
|
|
|
|
|
LoadBackupDrive = False |
|
|
|
AutoBackups = True |
|
|
|
complete_phrase = './Applio-'+juxxn+'-Fork/' |
|
os.chdir(f'./Applio-{juxxn}-Fork/') |
|
from utils import backups |
|
|
|
def generate_random_string(length=6): |
|
characters = string.ascii_lowercase + string.digits |
|
return ''.join(random.choice(characters) for _ in range(length)) |
|
|
|
parte_aleatoria = generate_random_string() |
|
|
|
if namepython == "infer-web.py": |
|
nuevo_nombre = f"AcatUI_{parte_aleatoria}.py" |
|
os.rename(os.path.join(complete_phrase, "infer-web.py"), os.path.join(complete_phrase, nuevo_nombre)) |
|
namepython = nuevo_nombre |
|
|
|
LOGS_FOLDER = './Applio-' + juxxn + '-Fork/logs' |
|
if not os.path.exists(LOGS_FOLDER): |
|
os.makedirs(LOGS_FOLDER) |
|
clear_output() |
|
|
|
WEIGHTS_FOLDER = './Applio-' + juxxn + '-Fork' + '/logs' + '/weights' |
|
if not os.path.exists(WEIGHTS_FOLDER): |
|
os.makedirs(WEIGHTS_FOLDER) |
|
clear_output() |
|
|
|
others_FOLDER = './Applio-' + juxxn + '-Fork' + '/audio-others' |
|
if not os.path.exists(others_FOLDER): |
|
os.makedirs(others_FOLDER) |
|
clear_output() |
|
|
|
audio_outputs_FOLDER = './Applio-' + juxxn + '-Fork' + '/audio-outputs' |
|
if not os.path.exists(audio_outputs_FOLDER): |
|
os.makedirs(audio_outputs_FOLDER) |
|
clear_output() |
|
|
|
|
|
i18n_path = './Applio-' + juxxn + '-Fork/' + 'i18n.py' |
|
i18n_new_path = './Applio-' + juxxn + '-Fork/' + 'utils/i18n.py' |
|
try: |
|
if os.path.exists(i18n_path) and os.path.exists(i18n_new_path): |
|
shutil.move(i18n_new_path, i18n_path) |
|
except FileNotFoundError: |
|
print("Translation couldn't be applied successfully. Please restart the environment and run the cell again.") |
|
clear_output() |
|
SelectedLanguage = "en_US" |
|
new_language_line = ' language = "' + SelectedLanguage + '"\n' |
|
|
|
try: |
|
with open(i18n_path, 'r') as file: |
|
lines = file.readlines() |
|
|
|
with open(i18n_path, 'w') as file: |
|
for index, line in enumerate(lines): |
|
if index == 14: |
|
file.write(new_language_line) |
|
else: |
|
file.write(line) |
|
|
|
except FileNotFoundError: |
|
print("Translation couldn't be applied successfully. Please restart the environment and run the cell again.") |
|
clear_output() |
|
|
|
|
|
|
|
def tempus_killed_server(): |
|
os.system("cd ./Retrieval-based-{complete_phrase}") |
|
os.system("load_ext tensorboard") |
|
clear_output() |
|
os.system("tensorboard --logdir ./Applio-$juxxn-Fork/logs") |
|
os.system("mkdir -p ./Applio-$juxxn-Fork/audios") |
|
print("Try") |
|
arguments = "--colab --pycmd python3" |
|
os.system("python3 $namepython $arguments") |
|
|
|
|
|
if LoadBackupDrive: |
|
backups.import_google_drive_backup() |
|
|
|
|
|
server_thread = threading.Thread(target=tempus_killed_server) |
|
server_thread.start() |
|
|
|
if AutoBackups: |
|
backups.backup_files() |
|
else: |
|
while True: |
|
time.sleep(11) |