Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,13 +7,20 @@ os.system('pip freeze')
|
|
7 |
os.system('pip install jamo')
|
8 |
|
9 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
import argparse
|
11 |
import re
|
12 |
from string import punctuation
|
13 |
|
14 |
|
15 |
-
|
16 |
-
# 1
|
17 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
18 |
classifier = pipeline(model="suno/bark")
|
19 |
output = pipeline("Hey it's HuggingFace on the phone!")
|
@@ -43,10 +50,38 @@ examples = [
|
|
43 |
["μμ°μ΄ μ²λ¦¬μλ μμ°μ΄ λΆμ, μμ°μ΄ μ΄ν΄, μμ°μ΄ μμ± λ±μ κΈ°μ μ΄ μ¬μ©λλ€."],
|
44 |
["μΈμμ μΌλ‘ μ¬λμ μ리λ₯Ό ν©μ±νλ μμ€ν
μ΄λ©°, ν
μ€νΈλ₯Ό μμ±μΌλ‘ λ³ννλ€λ λ°μ ν
μ€νΈ μμ± λ³ν."]
|
45 |
]
|
46 |
-
gr.Interface(gen_tts, inputs, outputs, title=title, description=description, article=article, examples=examples, enable_queue=True).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
'''
|
52 |
# 3:fastspeech2 + vocgan + myvoice data
|
|
|
7 |
os.system('pip install jamo')
|
8 |
|
9 |
import gradio as gr
|
10 |
+
from subprocess import call
|
11 |
+
|
12 |
+
if (not os.path.exists("korean.py")):
|
13 |
+
os.system("wget https://github.com/zhanglina94/TTS_Projects/blob/main/fastspeech2_ko/korean.py -O korean.py")
|
14 |
+
|
15 |
+
import korean
|
16 |
+
|
17 |
import argparse
|
18 |
import re
|
19 |
from string import punctuation
|
20 |
|
21 |
|
22 |
+
'''
|
23 |
+
# 1:Bark Γ
|
24 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
25 |
classifier = pipeline(model="suno/bark")
|
26 |
output = pipeline("Hey it's HuggingFace on the phone!")
|
|
|
50 |
["μμ°μ΄ μ²λ¦¬μλ μμ°μ΄ λΆμ, μμ°μ΄ μ΄ν΄, μμ°μ΄ μμ± λ±μ κΈ°μ μ΄ μ¬μ©λλ€."],
|
51 |
["μΈμμ μΌλ‘ μ¬λμ μ리λ₯Ό ν©μ±νλ μμ€ν
μ΄λ©°, ν
μ€νΈλ₯Ό μμ±μΌλ‘ λ³ννλ€λ λ°μ ν
μ€νΈ μμ± λ³ν."]
|
52 |
]
|
53 |
+
gr.Interface(gen_tts, inputs, outputs, title=title, description=description, article=article, examples=examples, enable_queue=True).launch()'''
|
54 |
+
|
55 |
+
# 2:TTS coqui-ai
|
56 |
+
|
57 |
+
def run_cmd(command):
|
58 |
+
try:
|
59 |
+
print(command)
|
60 |
+
call(command)
|
61 |
+
except KeyboardInterrupt:
|
62 |
+
print("Process interrupted")
|
63 |
+
sys.exit(1)
|
64 |
+
|
65 |
+
def inference(text):
|
66 |
+
cmd = ['tts', '--text', "".join(korean.tokenize(text)), '--model_path', 'vits-kss-checkpoint_90000.pth', '--config_path', 'vits-kss-config.json']
|
67 |
+
run_cmd(cmd)
|
68 |
+
return 'tts_output.wav'
|
69 |
|
70 |
+
if (not os.path.exists("vits-kss-checkpoint_90000.pth")):
|
71 |
+
os.system("wget -q https://huggingface.co/youngs3/coqui-vits-ko/resolve/main/vits-kss-checkpoint_90000.pth -O vits-kss-checkpoint_90000.pth")
|
72 |
+
os.system("wget -q https://huggingface.co/youngs3/coqui-vits-ko/resolve/main/vits-kss-config.json -O vits-kss-config.json")
|
73 |
|
74 |
+
inputs = gr.inputs.Textbox(lines=5, label="Input Text")
|
75 |
+
outputs = gr.outputs.Audio(type="file",label="Output Audio")
|
76 |
+
title = "Korean Language TTS"
|
77 |
+
description = "Gradio demo for coqui-ai-TTS, using a VITS model trained on the kss dataset. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
|
78 |
+
article = "<p style='text-align: center'><a href='https://tts.readthedocs.io/en/latest/'>TTS </a> | <a href='https://github.com/zhanglina94/TTS_Projects'>Github Repo</a></p>"
|
79 |
+
examples = [
|
80 |
+
["μ»΄ν¨ν° λΉμ μ κΈ°κ³μ μκ°μ ν΄λΉνλ λΆλΆμ μ°κ΅¬νλ μ»΄ν¨ν° κ³Όνμ μ΅μ μ°κ΅¬ λΆμΌ μ€ νλμ΄λ€."],
|
81 |
+
["μμ°μ΄ μ²λ¦¬μλ μμ°μ΄ λΆμ, μμ°μ΄ μ΄ν΄, μμ°μ΄ μμ± λ±μ κΈ°μ μ΄ μ¬μ©λλ€."],
|
82 |
+
["μΈμμ μΌλ‘ μ¬λμ μ리λ₯Ό ν©μ±νλ μμ€ν
μ΄λ©°, ν
μ€νΈλ₯Ό μμ±μΌλ‘ λ³ννλ€λ λ°μ ν
μ€νΈ μμ± λ³ν."]
|
83 |
+
]
|
84 |
+
gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples, enable_queue=True).launch()
|
85 |
|
86 |
'''
|
87 |
# 3:fastspeech2 + vocgan + myvoice data
|