TDN-M commited on
Commit
eed20c1
·
verified ·
1 Parent(s): 38b7ebd

Update tts.py

Browse files
Files changed (1) hide show
  1. tts.py +1 -9
tts.py CHANGED
@@ -38,7 +38,7 @@ MODEL = Xtts.init_from_config(config)
38
  MODEL.load_checkpoint(config, checkpoint_dir=checkpoint_dir, use_deepspeed=use_deepspeed)
39
 
40
  # Đảm bảo mô hình chạy trên CPU
41
- MODEL.to("cpu") # Chuyển mô hình sang CPU
42
 
43
  # Danh sách ngôn ngữ được hỗ trợ (chỉ tiếng Việt và tiếng Anh)
44
  supported_languages = ["vi", "en"]
@@ -106,11 +106,3 @@ def generate_speech(text, language="vi", speaker_wav=None, normalize_text=True):
106
 
107
  except Exception as e:
108
  raise RuntimeError(f"Lỗi khi tạo giọng nói: {str(e)}")
109
-
110
-
111
- if __name__ == "__main__":
112
- # Ví dụ sử dụng
113
- text = "Xin chào, đây là một đoạn văn bản được chuyển thành giọng nói."
114
- speaker_wav = "voices/sample_voice.wav" # Đường dẫn đến file âm thanh mẫu trong thư mục /voices
115
- output_audio = generate_speech(text, language="vi", speaker_wav=speaker_wav)
116
- print(f"File âm thanh đã được tạo: {output_audio}")
 
38
  MODEL.load_checkpoint(config, checkpoint_dir=checkpoint_dir, use_deepspeed=use_deepspeed)
39
 
40
  # Đảm bảo mô hình chạy trên CPU
41
+ MODEL.to("cpu")
42
 
43
  # Danh sách ngôn ngữ được hỗ trợ (chỉ tiếng Việt và tiếng Anh)
44
  supported_languages = ["vi", "en"]
 
106
 
107
  except Exception as e:
108
  raise RuntimeError(f"Lỗi khi tạo giọng nói: {str(e)}")