OuroborosM commited on
Commit
ce5b544
·
1 Parent(s): 87c1054

update audio

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -79,6 +79,7 @@ from datasets import load_dataset
79
 
80
  from transformers import pipeline
81
 
 
82
 
83
  ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
84
  sample = ds[0]["audio"]
@@ -103,7 +104,9 @@ def text_to_speech_loc(text):
103
  model="microsoft/speecht5_tts",
104
  device=device,
105
  )
106
- audio = pipe(text)["audio"]
 
 
107
  return audio
108
 
109
  print("text to speech: ", text_to_speech_loc("Good morning."))
 
79
 
80
  from transformers import pipeline
81
 
82
+ import soundfile as sf
83
 
84
  ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
85
  sample = ds[0]["audio"]
 
104
  model="microsoft/speecht5_tts",
105
  device=device,
106
  )
107
+ speech = pipe(text)["audio"]
108
+ audio = sf.write("convert1.wav", speech.numpy(), samplerate=16000)
109
+
110
  return audio
111
 
112
  print("text to speech: ", text_to_speech_loc("Good morning."))