Spaces:
Build error
Build error
LPhilp1943
commited on
Commit
•
5cb3ee9
1
Parent(s):
4d6639c
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
import os
|
|
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
import soundfile as sf
|
@@ -7,6 +9,21 @@ import librosa
|
|
7 |
from TTS.api import TTS
|
8 |
from TTS.utils.manage import ModelManager
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Agreeing to Coqui TTS terms of service and setting up environment variables
|
11 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
12 |
os.makedirs("output_audio", exist_ok=True)
|
|
|
1 |
import os
|
2 |
+
import sys
|
3 |
+
import subprocess
|
4 |
import gradio as gr
|
5 |
import torch
|
6 |
import soundfile as sf
|
|
|
9 |
from TTS.api import TTS
|
10 |
from TTS.utils.manage import ModelManager
|
11 |
|
12 |
+
def install_sentencepiece():
|
13 |
+
try:
|
14 |
+
# Attempting to install sentencepiece via pip
|
15 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "sentencepiece"])
|
16 |
+
except subprocess.CalledProcessError:
|
17 |
+
# Attempt to install sentencepiece via system package manager if pip install fails
|
18 |
+
if os.name == "posix":
|
19 |
+
os.system("sudo apt-get install -y libprotobuf10 protobuf-compiler libprotobuf-dev")
|
20 |
+
os.system("sudo apt-get install -y libsentencepiece-dev")
|
21 |
+
else:
|
22 |
+
raise OSError("Automatic installation of SentencePiece is not supported on this OS")
|
23 |
+
|
24 |
+
# Call the function to attempt installing SentencePiece
|
25 |
+
install_sentencepiece()
|
26 |
+
|
27 |
# Agreeing to Coqui TTS terms of service and setting up environment variables
|
28 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
29 |
os.makedirs("output_audio", exist_ok=True)
|