Spaces:
Sleeping
Sleeping
Commit
·
35525fe
1
Parent(s):
25ba06e
fixes
Browse files
app.py
CHANGED
|
@@ -29,6 +29,14 @@ import soundfile as sf
|
|
| 29 |
|
| 30 |
from model import get_pretrained_model, language_to_models
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
def MyPrint(s):
|
| 34 |
now = datetime.now()
|
|
@@ -127,14 +135,14 @@ def build_html_output(s: str, style: str = "result_item_success"):
|
|
| 127 |
|
| 128 |
|
| 129 |
def process(language: str, repo_id: str, text: str, sid: str, speed: float):
|
|
|
|
| 130 |
if len(text) > 1000:
|
| 131 |
info = (
|
| 132 |
"To ensure this space is responsive, please use short text for testing\n"
|
| 133 |
+ "You can run sherpa-onnx locally to process long texts."
|
| 134 |
)
|
| 135 |
-
return
|
| 136 |
|
| 137 |
-
MyPrint(f"Input text: {text}. sid: {sid}, speed: {speed}")
|
| 138 |
sid = int(sid)
|
| 139 |
tts = get_pretrained_model(repo_id, speed)
|
| 140 |
|
|
|
|
| 29 |
|
| 30 |
from model import get_pretrained_model, language_to_models
|
| 31 |
|
| 32 |
+
hint_filename = f"{uuid.uuid4()}.wav"
|
| 33 |
+
os.system(
|
| 34 |
+
f"""
|
| 35 |
+
wget https://huggingface.co/spaces/k2-fsa/text-to-speech/resolve/main/hint.wav
|
| 36 |
+
mv -v hint.wav {hint_filename}
|
| 37 |
+
"""
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
|
| 41 |
def MyPrint(s):
|
| 42 |
now = datetime.now()
|
|
|
|
| 135 |
|
| 136 |
|
| 137 |
def process(language: str, repo_id: str, text: str, sid: str, speed: float):
|
| 138 |
+
MyPrint(f"Input text {len(text)}: {text}. sid: {sid}, speed: {speed}")
|
| 139 |
if len(text) > 1000:
|
| 140 |
info = (
|
| 141 |
"To ensure this space is responsive, please use short text for testing\n"
|
| 142 |
+ "You can run sherpa-onnx locally to process long texts."
|
| 143 |
)
|
| 144 |
+
return hint_filename, build_html_output(info)
|
| 145 |
|
|
|
|
| 146 |
sid = int(sid)
|
| 147 |
tts = get_pretrained_model(repo_id, speed)
|
| 148 |
|