94insane commited on
Commit
2e4e4cc
Β·
1 Parent(s): 74546ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -4
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:🐢 Bark TTS
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
- # 2:TTS
 
 
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