archivartaunik commited on
Commit
9273eea
·
verified ·
1 Parent(s): a7ce232

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -17
app.py CHANGED
@@ -5,7 +5,7 @@ from tqdm import tqdm
5
  from underthesea import sent_tokenize
6
  from TTS.tts.configs.xtts_config import XttsConfig
7
  from TTS.tts.models.xtts import Xtts
8
- from huggingface_hub import hf_hub_downloadimport
9
  import os
10
  import sys
11
  import tempfile
@@ -22,7 +22,6 @@ if os.path.exists("XTTSv2-Finetuning-for-New-Languages/TTS"):
22
  # Дадаем тэчку TTS у PYTHONPATH
23
  sys.path.append("./TTS")
24
 
25
-
26
  # Вызначэнне прылады (выкарыстоўваецца GPU, калі даступна)
27
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
28
 
@@ -44,21 +43,6 @@ XTTS_MODEL.load_checkpoint(config, checkpoint_path=checkpoint_file, vocab_path=v
44
  XTTS_MODEL.to(device)
45
 
46
 
47
-
48
- def text_to_speech(belarusian_story, lang="be", speaker_audio_file=default_voice_file):
49
- # Правяраем, ці пададзены файл голасу
50
- if speaker_audio_file is None:
51
- raise ValueError("Speaker audio file is not provided.")
52
-
53
- # Атрыманне латэнтных умоў і эмацый
54
- gpt_cond_latent, speaker_embedding = XTTS_MODEL.get_conditioning_latents(
55
- audio_path=speaker_audio_file,
56
- gpt_cond_len=XTTS_MODEL.config.gpt_cond_len,
57
- max_ref_length=XTTS_MODEL.config.max_ref_len,
58
- sound_norm_refs=XTTS_MODEL.config.sound_norm_refs,
59
- )
60
-
61
-
62
  def text_to_speech(belarusian_story, lang="be", speaker_audio_file=None):
63
  # Калі файл не пададзены, выкарыстоўваем голас па змаўчанні
64
  if not speaker_audio_file or (not isinstance(speaker_audio_file, str) and speaker_audio_file.name == ""):
 
5
  from underthesea import sent_tokenize
6
  from TTS.tts.configs.xtts_config import XttsConfig
7
  from TTS.tts.models.xtts import Xtts
8
+ from huggingface_hub import hf_hub_download
9
  import os
10
  import sys
11
  import tempfile
 
22
  # Дадаем тэчку TTS у PYTHONPATH
23
  sys.path.append("./TTS")
24
 
 
25
  # Вызначэнне прылады (выкарыстоўваецца GPU, калі даступна)
26
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
27
 
 
43
  XTTS_MODEL.to(device)
44
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  def text_to_speech(belarusian_story, lang="be", speaker_audio_file=None):
47
  # Калі файл не пададзены, выкарыстоўваем голас па змаўчанні
48
  if not speaker_audio_file or (not isinstance(speaker_audio_file, str) and speaker_audio_file.name == ""):