Yurii Paniv commited on
Commit
57c5ab0
1 Parent(s): 64fcafd

#8 Add CUDA flag

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. ukrainian_tts/tts.py +4 -3
app.py CHANGED
@@ -17,13 +17,13 @@ class VoiceOption(Enum):
17
  Dmytro = "Дмитро (чоловічий) 👨"
18
  Olga = "Ольга (жіночий) 👩"
19
 
20
- print(f"CUDA available? {is_available}")
21
 
22
  badge = (
23
  "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=robinhad.ukrainian-tts"
24
  )
25
 
26
- ukr_tts = TTS()
27
 
28
 
29
  def tts(text: str, voice: str, stress: str):
17
  Dmytro = "Дмитро (чоловічий) 👨"
18
  Olga = "Ольга (жіночий) 👩"
19
 
20
+ print(f"CUDA available? {is_available()}")
21
 
22
  badge = (
23
  "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=robinhad.ukrainian-tts"
24
  )
25
 
26
+ ukr_tts = TTS(use_cuda=is_available())
27
 
28
 
29
  def tts(text: str, voice: str, stress: str):
ukrainian_tts/tts.py CHANGED
@@ -27,12 +27,12 @@ class TTS:
27
  """
28
 
29
  """
30
- def __init__(self, cache_folder=None) -> None:
31
  """
32
  Class to setup a text-to-speech engine, from download to model creation. \n
33
  Downloads or uses files from `cache_folder` directory. \n
34
  By default stores in current directory."""
35
- self.__setup_cache(cache_folder)
36
 
37
 
38
  def tts(self, text: str, voice: str, stress: str, output_fp=BytesIO()):
@@ -61,7 +61,7 @@ class TTS:
61
  return output_fp
62
 
63
 
64
- def __setup_cache(self, cache_folder=None):
65
  """Downloads models and stores them into `cache_folder`. By default stores in current directory."""
66
  print("downloading uk/mykyta/vits-tts")
67
  release_number = "v3.0.0"
@@ -86,6 +86,7 @@ class TTS:
86
  speakers_path,
87
  None,
88
  None,
 
89
  )
90
 
91
  if self.synthesizer is None:
27
  """
28
 
29
  """
30
+ def __init__(self, cache_folder=None, use_cuda=False) -> None:
31
  """
32
  Class to setup a text-to-speech engine, from download to model creation. \n
33
  Downloads or uses files from `cache_folder` directory. \n
34
  By default stores in current directory."""
35
+ self.__setup_cache(cache_folder, use_cuda=use_cuda)
36
 
37
 
38
  def tts(self, text: str, voice: str, stress: str, output_fp=BytesIO()):
61
  return output_fp
62
 
63
 
64
+ def __setup_cache(self, cache_folder=None, use_cuda=False):
65
  """Downloads models and stores them into `cache_folder`. By default stores in current directory."""
66
  print("downloading uk/mykyta/vits-tts")
67
  release_number = "v3.0.0"
86
  speakers_path,
87
  None,
88
  None,
89
+ use_cuda=use_cuda
90
  )
91
 
92
  if self.synthesizer is None: