Spaces:
Runtime error
Runtime error
Commit
·
5dcf83f
1
Parent(s):
927ba81
update wav transfer
Browse files- app.py +7 -1
- requirements.txt +1 -0
app.py
CHANGED
@@ -80,6 +80,7 @@ from datasets import load_dataset
|
|
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"]
|
@@ -106,8 +107,13 @@ def text_to_speech_loc(text):
|
|
106 |
)
|
107 |
speech = pipe(text)["audio"]
|
108 |
print("Type of speech: ", type(speech))
|
109 |
-
audio = sf.write("convert1.wav", speech, samplerate=16000)
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
return audio
|
112 |
|
113 |
print("text to speech: ", text_to_speech_loc("Good morning."))
|
|
|
80 |
from transformers import pipeline
|
81 |
|
82 |
import soundfile as sf
|
83 |
+
from scipy.io import wavfile
|
84 |
|
85 |
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
|
86 |
sample = ds[0]["audio"]
|
|
|
107 |
)
|
108 |
speech = pipe(text)["audio"]
|
109 |
print("Type of speech: ", type(speech))
|
|
|
110 |
|
111 |
+
timestr = time.strftime("%Y%m%d-%H%M%S")
|
112 |
+
sampling_rate = 16000
|
113 |
+
with open('sample-' + timestr + '.wav', 'wb') as audio:
|
114 |
+
wavfile.write(audio, sampling_rate, speech)
|
115 |
+
# audio = sf.write("convert1.wav", speech, samplerate=16000)
|
116 |
+
print("audio: ", audio)
|
117 |
return audio
|
118 |
|
119 |
print("text to speech: ", text_to_speech_loc("Good morning."))
|
requirements.txt
CHANGED
@@ -21,3 +21,4 @@ python-pptx
|
|
21 |
datasets
|
22 |
soundfile
|
23 |
librosa
|
|
|
|
21 |
datasets
|
22 |
soundfile
|
23 |
librosa
|
24 |
+
scipy
|