FrankZxShen
commited on
Commit
β’
0952db0
1
Parent(s):
415d53c
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,6 @@ language_marks = {
|
|
22 |
"Mix": "",
|
23 |
}
|
24 |
|
25 |
-
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
26 |
|
27 |
def get_text(text, hps, is_symbol):
|
28 |
text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)
|
@@ -33,13 +32,6 @@ def get_text(text, hps, is_symbol):
|
|
33 |
|
34 |
def create_tts_fn(model, hps, speaker_ids):
|
35 |
def tts_fn(text, speaker, language, ns, nsw, speed, is_symbol):
|
36 |
-
if limitation:
|
37 |
-
text_len = len(re.sub("\[([A-Z]{2})\]", "", text))
|
38 |
-
max_len = 150
|
39 |
-
if is_symbol:
|
40 |
-
max_len *= 3
|
41 |
-
if text_len > max_len:
|
42 |
-
return "Error: Text is too long", None
|
43 |
if language is not None:
|
44 |
text = language_marks[language] + text + language_marks[language]
|
45 |
speaker_id = speaker_ids[speaker]
|
@@ -171,7 +163,7 @@ if __name__ == "__main__":
|
|
171 |
with gr.Row():
|
172 |
with gr.Column():
|
173 |
textbox = gr.TextArea(label="Text",
|
174 |
-
placeholder="Type your sentence here
|
175 |
value="ζ°γγͺγγ£γ©γ解ζΎγ§γγγγγ«γͺγ£γγγγ§γγγ", elem_id=f"tts-input")
|
176 |
with gr.Accordion(label="Phoneme Input", open=False):
|
177 |
temp_text_var = gr.Variable()
|
|
|
22 |
"Mix": "",
|
23 |
}
|
24 |
|
|
|
25 |
|
26 |
def get_text(text, hps, is_symbol):
|
27 |
text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)
|
|
|
32 |
|
33 |
def create_tts_fn(model, hps, speaker_ids):
|
34 |
def tts_fn(text, speaker, language, ns, nsw, speed, is_symbol):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
if language is not None:
|
36 |
text = language_marks[language] + text + language_marks[language]
|
37 |
speaker_id = speaker_ids[speaker]
|
|
|
163 |
with gr.Row():
|
164 |
with gr.Column():
|
165 |
textbox = gr.TextArea(label="Text",
|
166 |
+
placeholder="Type your sentence here ",
|
167 |
value="ζ°γγͺγγ£γ©γ解ζΎγ§γγγγγ«γͺγ£γγγγ§γγγ", elem_id=f"tts-input")
|
168 |
with gr.Accordion(label="Phoneme Input", open=False):
|
169 |
temp_text_var = gr.Variable()
|