Pendrokar commited on
Commit
6caed5b
β€’
2 Parent(s): 32cf67f 79e67e9

Merge branch 'robotic_voice'

Browse files
Files changed (3) hide show
  1. README.md +1 -0
  2. app.py +19 -4
  3. gr_client.py +12 -2
README.md CHANGED
@@ -22,6 +22,7 @@ preload_from_hub:
22
  - Pendrokar/xvapitch_nvidia
23
  - Pendrokar/TorchMoji
24
  - Pendrokar/xvasynth_lojban
 
25
  license: gpl-3.0
26
  short_description: CPU powered, low RTF, emotional, multilingual TTS
27
  ---
 
22
  - Pendrokar/xvapitch_nvidia
23
  - Pendrokar/TorchMoji
24
  - Pendrokar/xvasynth_lojban
25
+ - Pendrokar/xvasynth_cabal
26
  license: gpl-3.0
27
  short_description: CPU powered, low RTF, emotional, multilingual TTS
28
  ---
app.py CHANGED
@@ -9,17 +9,29 @@ import resources.app.no_server as xvaserver
9
 
10
  from gr_client import BlocksDemo
11
 
12
- # model
13
  hf_model_name = "Pendrokar/xvapitch_nvidia"
14
  model_repo = HfApi()
15
  commits = model_repo.list_repo_commits(repo_id=hf_model_name)
16
  latest_commit_sha = commits[0].commit_id
17
  hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
 
18
 
 
19
  commits = model_repo.list_repo_commits(repo_id='Pendrokar/xvasynth_lojban')
20
  latest_commit_sha = commits[0].commit_id
21
  hf_cache_lojban_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvasynth_lojban/snapshots/{latest_commit_sha}/'
22
- models_path = hf_cache_models_path
 
 
 
 
 
 
 
 
 
 
23
 
24
  current_voice_model = None
25
  current_voice_type = None
@@ -33,7 +45,10 @@ def load_model(voice_model_name):
33
  model_path = hf_cache_lojban_models_path + voice_model_name
34
  model_type = 'FastPitch1.1'
35
  else:
36
- model_path = models_path + voice_model_name
 
 
 
37
  model_type = 'xVAPitch'
38
 
39
  language = 'en' # seems to have no effect if generated text is from a different language
@@ -199,5 +214,5 @@ class LocalBlocksDemo(BlocksDemo):
199
 
200
  if __name__ == "__main__":
201
  print('running custom Gradio interface')
202
- demo = LocalBlocksDemo(models_path, hf_cache_lojban_models_path)
203
  demo.block.launch()
 
9
 
10
  from gr_client import BlocksDemo
11
 
12
+ # NVIDIA NeMo models
13
  hf_model_name = "Pendrokar/xvapitch_nvidia"
14
  model_repo = HfApi()
15
  commits = model_repo.list_repo_commits(repo_id=hf_model_name)
16
  latest_commit_sha = commits[0].commit_id
17
  hf_cache_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvapitch_nvidia/snapshots/{latest_commit_sha}/'
18
+ models_path = hf_cache_models_path
19
 
20
+ # Lojban model
21
  commits = model_repo.list_repo_commits(repo_id='Pendrokar/xvasynth_lojban')
22
  latest_commit_sha = commits[0].commit_id
23
  hf_cache_lojban_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvasynth_lojban/snapshots/{latest_commit_sha}/'
24
+
25
+ # Robotic model
26
+ hf_cache_robotic_models_path = ''
27
+ try:
28
+ commits = model_repo.list_repo_commits(repo_id='Pendrokar/xvasynth_cabal', token=os.getenv('HF_TOKEN'))
29
+ latest_commit_sha = commits[0].commit_id
30
+ hf_cache_robotic_models_path = f'/home/user/.cache/huggingface/hub/models--Pendrokar--xvasynth_cabal/snapshots/{latest_commit_sha}/'
31
+ except:
32
+ print('Robotic voice not loaded!')
33
+ pass
34
+
35
 
36
  current_voice_model = None
37
  current_voice_type = None
 
45
  model_path = hf_cache_lojban_models_path + voice_model_name
46
  model_type = 'FastPitch1.1'
47
  else:
48
+ if voice_model_name == 'cnc_cabal':
49
+ model_path = hf_cache_robotic_models_path + voice_model_name
50
+ else:
51
+ model_path = models_path + voice_model_name
52
  model_type = 'xVAPitch'
53
 
54
  language = 'en' # seems to have no effect if generated text is from a different language
 
214
 
215
  if __name__ == "__main__":
216
  print('running custom Gradio interface')
217
+ demo = LocalBlocksDemo(models_path, hf_cache_lojban_models_path, hf_cache_robotic_models_path)
218
  demo.block.launch()
gr_client.py CHANGED
@@ -316,9 +316,17 @@ _DESCRIPTION = '''
316
 
317
 
318
  class BlocksDemo:
319
- def __init__(self, models_path, lojban_models_path):
 
320
  self.models_path = models_path
321
  self.lojban_models_path = lojban_models_path
 
 
 
 
 
 
 
322
  self.block = self.create_interface()
323
 
324
  def create_interface(self):
@@ -605,6 +613,8 @@ class BlocksDemo:
605
 
606
  if voice_id == 'x_selpahi':
607
  sample_path = self.lojban_models_path
 
 
608
  else:
609
  sample_path = self.models_path
610
 
@@ -620,5 +630,5 @@ if __name__ == "__main__":
620
  print('running Gradio interface')
621
  client = Client("Pendrokar/xVASynth")
622
 
623
- demo = BlocksDemo('', '')
624
  demo.block.launch()
 
316
 
317
 
318
  class BlocksDemo:
319
+ def __init__(self, models_path, lojban_models_path, robotic_models_path):
320
+ # global voice_radio_init
321
  self.models_path = models_path
322
  self.lojban_models_path = lojban_models_path
323
+ self.robotic_models_path = robotic_models_path
324
+
325
+ if robotic_models_path != '':
326
+ # insert robotic voice as the third option
327
+ voice_models.append(("πŸ€– Robot", "cnc_cabal"))
328
+ voice_radio_init['choices'].insert(2, ("πŸ€– Robot", "cnc_cabal"))
329
+
330
  self.block = self.create_interface()
331
 
332
  def create_interface(self):
 
613
 
614
  if voice_id == 'x_selpahi':
615
  sample_path = self.lojban_models_path
616
+ if voice_id == 'cnc_cabal':
617
+ sample_path = self.robotic_models_path
618
  else:
619
  sample_path = self.models_path
620
 
 
630
  print('running Gradio interface')
631
  client = Client("Pendrokar/xVASynth")
632
 
633
+ demo = BlocksDemo('', '', '')
634
  demo.block.launch()