Spaces:
Runtime error
Runtime error
Commit
·
78dcdde
1
Parent(s):
6638745
Update app_multi.py
Browse files- app_multi.py +40 -0
app_multi.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from typing import Union
|
| 2 |
|
| 3 |
from argparse import ArgumentParser
|
|
|
|
| 4 |
|
| 5 |
import asyncio
|
| 6 |
import json
|
|
@@ -128,6 +129,45 @@ print(f'Models loaded: {len(loaded_models)}')
|
|
| 128 |
tts_speakers_list = asyncio.get_event_loop().run_until_complete(edge_tts.list_voices()) # noqa
|
| 129 |
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
# https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/blob/main/infer-web.py#L118 # noqa
|
| 132 |
def vc_func(
|
| 133 |
input_audio, model_index, pitch_adjust, f0_method, feat_ratio,
|
|
|
|
| 1 |
from typing import Union
|
| 2 |
|
| 3 |
from argparse import ArgumentParser
|
| 4 |
+
from pathlib import Path
|
| 5 |
|
| 6 |
import asyncio
|
| 7 |
import json
|
|
|
|
| 129 |
tts_speakers_list = asyncio.get_event_loop().run_until_complete(edge_tts.list_voices()) # noqa
|
| 130 |
|
| 131 |
|
| 132 |
+
# Bilibili
|
| 133 |
+
def youtube_downloader(
|
| 134 |
+
video_identifier,
|
| 135 |
+
start_time,
|
| 136 |
+
end_time,
|
| 137 |
+
output_filename="track.wav",
|
| 138 |
+
num_attempts=5,
|
| 139 |
+
url_base="",
|
| 140 |
+
quiet=False,
|
| 141 |
+
force=True,
|
| 142 |
+
):
|
| 143 |
+
output_path = Path(output_filename)
|
| 144 |
+
if output_path.exists():
|
| 145 |
+
if not force:
|
| 146 |
+
return output_path
|
| 147 |
+
else:
|
| 148 |
+
output_path.unlink()
|
| 149 |
+
|
| 150 |
+
quiet = "--quiet --no-warnings" if quiet else ""
|
| 151 |
+
command = f"""
|
| 152 |
+
yt-dlp {quiet} -x --audio-format wav -f bestaudio -o "{output_filename}" --download-sections "*{start_time}-{end_time}" "{url_base}{video_identifier}" # noqa: E501
|
| 153 |
+
""".strip()
|
| 154 |
+
|
| 155 |
+
attempts = 0
|
| 156 |
+
while True:
|
| 157 |
+
try:
|
| 158 |
+
_ = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
|
| 159 |
+
except subprocess.CalledProcessError:
|
| 160 |
+
attempts += 1
|
| 161 |
+
if attempts == num_attempts:
|
| 162 |
+
return None
|
| 163 |
+
else:
|
| 164 |
+
break
|
| 165 |
+
|
| 166 |
+
if output_path.exists():
|
| 167 |
+
return output_path
|
| 168 |
+
else:
|
| 169 |
+
return None
|
| 170 |
+
|
| 171 |
# https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/blob/main/infer-web.py#L118 # noqa
|
| 172 |
def vc_func(
|
| 173 |
input_audio, model_index, pitch_adjust, f0_method, feat_ratio,
|