bcci commited on
Commit
be87c08
·
verified ·
1 Parent(s): 1ef53a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -5,6 +5,23 @@ import struct
5
  import os
6
  import time
7
  import json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  import numpy as np
10
  import torch
@@ -152,7 +169,7 @@ def tokenizer(text: str):
152
  """
153
  Converts text to a list of phoneme tokens using the global vocabulary.
154
  """
155
- phonemes_string, _ = g2p(text)
156
  phonemes = [ph for ph in phonemes_string]
157
  print(phonemes_string)
158
  tokens = [phoneme_vocab[phoneme] for phoneme in phonemes if phoneme in phoneme_vocab]
 
5
  import os
6
  import time
7
  import json
8
+ import os
9
+ import subprocess
10
+ subprocess.run(['apt-get', 'update'])
11
+ subprocess.run(['apt-get', 'install', '-y', 'build-essential', 'gawk', 'libasound2-dev', 'libpulse-dev', 'autoconf', 'automake', 'libtool'])
12
+ subprocess.run(['wget', 'https://github.com/espeak-ng/espeak-ng/archive/refs/tags/1.52.0.tar.gz'])
13
+ subprocess.run(['tar', 'xf', '1.52.0.tar.gz'])
14
+ cwd = 'espeak-ng-1.52.0'
15
+ subprocess.run(['./autogen.sh'], cwd=cwd)
16
+ subprocess.run(['./configure'], cwd=cwd)
17
+ subprocess.run(['make'], cwd=cwd)
18
+ subprocess.run(['make', 'install'], cwd=cwd)
19
+ del cwd
20
+ env = os.environ.copy()
21
+ env['LD_PRELOAD'] = '/usr/local/lib/libespeak-ng.so.1'
22
+ subprocess.run(['espeak-ng', '--version'], env=env)
23
+ from phonemizer.backend.espeak.wrapper import EspeakWrapper
24
+ EspeakWrapper.set_library('/usr/local/lib/libespeak-ng.so.1')
25
 
26
  import numpy as np
27
  import torch
 
169
  """
170
  Converts text to a list of phoneme tokens using the global vocabulary.
171
  """
172
+ phonemes_string, tokens = g2p(text)
173
  phonemes = [ph for ph in phonemes_string]
174
  print(phonemes_string)
175
  tokens = [phoneme_vocab[phoneme] for phoneme in phonemes if phoneme in phoneme_vocab]