Upload 2 files
Browse files- app.py +2 -7
- requirements.txt +0 -1
app.py
CHANGED
@@ -9,14 +9,9 @@ tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech",
|
|
9 |
|
10 |
# 推論関数の定義
|
11 |
def synthesize_speech(text):
|
12 |
-
# テキストをトークンIDに変換
|
13 |
-
tokens = tacotron2.tokenize(text)
|
14 |
-
|
15 |
-
# トークンIDをLong型のテンソルに変換
|
16 |
-
tokens = torch.LongTensor(tokens)
|
17 |
-
|
18 |
# Tacotron2でmel spectrogramを生成
|
19 |
-
|
|
|
20 |
|
21 |
# HiFi-GANでmel spectrogramから音声を生成
|
22 |
waveforms = hifi_gan.decode_batch(mel_output)
|
|
|
9 |
|
10 |
# 推論関数の定義
|
11 |
def synthesize_speech(text):
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Tacotron2でmel spectrogramを生成
|
13 |
+
# テキストを直接入力として、LongTensorでラップする
|
14 |
+
mel_output, mel_length, alignment = tacotron2.encode_batch([text])
|
15 |
|
16 |
# HiFi-GANでmel spectrogramから音声を生成
|
17 |
waveforms = hifi_gan.decode_batch(mel_output)
|
requirements.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
gradio
|
2 |
speechbrain
|
3 |
torch
|
4 |
-
soundfile
|
|
|
1 |
gradio
|
2 |
speechbrain
|
3 |
torch
|
|