jhonparra18 commited on
Commit
547bc75
1 Parent(s): 8613d28

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +4 -3
inference.py CHANGED
@@ -24,12 +24,13 @@ gdown.download(f"{url}{file_id}", output, quiet=False)
24
  fake_voice=TTS(model_path=f"{cur_path}/best_model.pth",
25
  config_path=f"{cur_path}/config.json")
26
 
27
- def text_to_speech(text="Hola soy gustavo petro y esto es una prueba",output_name="test_audio.wav",model=fake_voice):
28
 
29
  model.tts_to_file(text,file_path=output_name)
30
  rate, data = wavfile.read(output_name)
31
- reduced_noise = nr.reduce_noise(y=data, sr=rate)
32
- wavfile.write(output_name, rate, reduced_noise)
 
33
  return output_name
34
 
35
 
 
24
  fake_voice=TTS(model_path=f"{cur_path}/best_model.pth",
25
  config_path=f"{cur_path}/config.json")
26
 
27
+ def text_to_speech(text="Hola soy gustavo petro y esto es una prueba",use_nr=True,output_name="test_audio.wav",model=fake_voice):
28
 
29
  model.tts_to_file(text,file_path=output_name)
30
  rate, data = wavfile.read(output_name)
31
+ if use_nr:
32
+ reduced_noise = nr.reduce_noise(y=data, sr=rate)
33
+ wavfile.write(output_name, rate, reduced_noise)
34
  return output_name
35
 
36