Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
·
55121a6
1
Parent(s):
32de8f8
update
Browse files- app.py +12 -11
- requirements.txt +4 -4
app.py
CHANGED
@@ -29,20 +29,20 @@ from TTS.tts.configs.xtts_config import XttsConfig
|
|
29 |
from TTS.tts.models.xtts import Xtts
|
30 |
from TTS.utils.generic_utils import get_user_data_dir
|
31 |
|
32 |
-
HF_TOKEN = os.environ.get("HF_TOKEN")
|
33 |
|
34 |
from huggingface_hub import HfApi
|
35 |
|
36 |
# will use api to restart space on a unrecoverable error
|
37 |
-
api = HfApi(token=HF_TOKEN)
|
38 |
repo_id = "coqui/xtts-streaming"
|
39 |
|
40 |
-
|
41 |
-
print("Export newer ffmpeg binary for denoise filter")
|
42 |
-
ZipFile("ffmpeg.zip").extractall()
|
43 |
-
print("Make ffmpeg binary executable")
|
44 |
-
st = os.stat('ffmpeg')
|
45 |
-
os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
46 |
|
47 |
# This will trigger downloading model
|
48 |
print("Downloading if not downloaded Coqui XTTS V1.1")
|
@@ -151,7 +151,8 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_clea
|
|
151 |
out_filename = speaker_wav + str(uuid.uuid4()) + ".wav" #ffmpeg to know output format
|
152 |
|
153 |
#we will use newer ffmpeg as that has afftn denoise filter
|
154 |
-
shell_command = f"./ffmpeg -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(" ")
|
|
|
155 |
|
156 |
command_result = subprocess.run([item for item in shell_command], capture_output=False,text=True, check=True)
|
157 |
speaker_wav=out_filename
|
@@ -277,7 +278,7 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_clea
|
|
277 |
)
|
278 |
|
279 |
# HF Space specific.. This error is unrecoverable need to restart space
|
280 |
-
api.restart_space(repo_id=repo_id)
|
281 |
else:
|
282 |
if "Failed to decode" in str(e):
|
283 |
print("Speaker encoding error", str(e))
|
@@ -560,4 +561,4 @@ gr.Interface(
|
|
560 |
article=article,
|
561 |
examples=examples,
|
562 |
cache_examples=False,
|
563 |
-
).queue().launch(debug=True,show_api=True)
|
|
|
29 |
from TTS.tts.models.xtts import Xtts
|
30 |
from TTS.utils.generic_utils import get_user_data_dir
|
31 |
|
32 |
+
#HF_TOKEN = os.environ.get("HF_TOKEN")
|
33 |
|
34 |
from huggingface_hub import HfApi
|
35 |
|
36 |
# will use api to restart space on a unrecoverable error
|
37 |
+
#api = HfApi(token=HF_TOKEN)
|
38 |
repo_id = "coqui/xtts-streaming"
|
39 |
|
40 |
+
## Use never ffmpeg binary for Ubuntu20 to use denoising for microphone input
|
41 |
+
#print("Export newer ffmpeg binary for denoise filter")
|
42 |
+
#ZipFile("ffmpeg.zip").extractall()
|
43 |
+
#print("Make ffmpeg binary executable")
|
44 |
+
#st = os.stat('ffmpeg')
|
45 |
+
#os.chmod('ffmpeg', st.st_mode | stat.S_IEXEC)
|
46 |
|
47 |
# This will trigger downloading model
|
48 |
print("Downloading if not downloaded Coqui XTTS V1.1")
|
|
|
151 |
out_filename = speaker_wav + str(uuid.uuid4()) + ".wav" #ffmpeg to know output format
|
152 |
|
153 |
#we will use newer ffmpeg as that has afftn denoise filter
|
154 |
+
#shell_command = f"./ffmpeg -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(" ")
|
155 |
+
shell_command = f"ffmpeg -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(" ")
|
156 |
|
157 |
command_result = subprocess.run([item for item in shell_command], capture_output=False,text=True, check=True)
|
158 |
speaker_wav=out_filename
|
|
|
278 |
)
|
279 |
|
280 |
# HF Space specific.. This error is unrecoverable need to restart space
|
281 |
+
#api.restart_space(repo_id=repo_id)
|
282 |
else:
|
283 |
if "Failed to decode" in str(e):
|
284 |
print("Speaker encoding error", str(e))
|
|
|
561 |
article=article,
|
562 |
examples=examples,
|
563 |
cache_examples=False,
|
564 |
+
).queue().launch(debug=True,show_api=True)
|
requirements.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# Preinstall requirements from TTS
|
2 |
-
torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118
|
3 |
-
torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118
|
4 |
-
torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
|
5 |
numpy==1.22.0;python_version<="3.10"
|
6 |
numpy==1.24.3;python_version>"3.10"
|
7 |
cython==0.29.30
|
@@ -59,4 +59,4 @@ deepspeed==0.8.3
|
|
59 |
pydub
|
60 |
cutlet
|
61 |
mecab-python3==1.0.6
|
62 |
-
unidic-lite==1.0.8
|
|
|
1 |
# Preinstall requirements from TTS
|
2 |
+
#torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118
|
3 |
+
#torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118
|
4 |
+
#torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
|
5 |
numpy==1.22.0;python_version<="3.10"
|
6 |
numpy==1.24.3;python_version>"3.10"
|
7 |
cython==0.29.30
|
|
|
59 |
pydub
|
60 |
cutlet
|
61 |
mecab-python3==1.0.6
|
62 |
+
unidic-lite==1.0.8
|