imenLa commited on
Commit
4328747
·
verified ·
1 Parent(s): 928ac71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,12 +1,18 @@
1
  import numpy as np
2
  import gradio as gr
3
  from scipy.io import wavfile
 
 
4
 
 
 
 
 
 
5
 
6
- notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
7
-
8
- def generate_tone(note, octave, duration):
9
- wav_file_path = "14763.wav"
10
  sr, audio_data = wavfile.read(wav_file_path)
11
 
12
  return sr, audio_data
 
1
  import numpy as np
2
  import gradio as gr
3
  from scipy.io import wavfile
4
+ from espnet2.bin.tts_inference import Text2Speech
5
+ import soundfile as sf
6
 
7
+ def generate_tts():
8
+ tts = Text2Speech.from_pretrained(model_file="exp/tts_train_conformer_fastspeech2_raw_phn_none/train.loss.ave.pth", vocoder_file="qasr_vocoder/voc1/exp/train_ljspeech_parallel_wavegan.v3/checkpoint-458989steps.pkl")
9
+ wav = tts("sil t r aa ii0 m a rr a < u0 x r aa uu0 sil h uu0 sil n uu0 uu0 z sil m aa ii0 b ii0 n aa k s t t aa ii0 m sil")["wav"]
10
+ audio_data = wav.numpy()
11
+ sf.write('output.wav', audio_data, samplerate=22050)
12
 
13
+ def generate_audio(note, octave, duration):
14
+ generate_tts()
15
+ wav_file_path = "output.wav"
 
16
  sr, audio_data = wavfile.read(wav_file_path)
17
 
18
  return sr, audio_data