specify audio dtype
Browse files- whisper_online.py +1 -1
- whisper_online_server.py +1 -1
whisper_online.py
CHANGED
|
@@ -11,7 +11,7 @@ import math
|
|
| 11 |
@lru_cache
|
| 12 |
def load_audio(fname):
|
| 13 |
a, _ = librosa.load(fname, sr=16000)
|
| 14 |
-
return a
|
| 15 |
|
| 16 |
def load_audio_chunk(fname, beg, end):
|
| 17 |
audio = load_audio(fname)
|
|
|
|
| 11 |
@lru_cache
|
| 12 |
def load_audio(fname):
|
| 13 |
a, _ = librosa.load(fname, sr=16000)
|
| 14 |
+
return a.astype('float32')
|
| 15 |
|
| 16 |
def load_audio_chunk(fname, beg, end):
|
| 17 |
audio = load_audio(fname)
|
whisper_online_server.py
CHANGED
|
@@ -138,7 +138,7 @@ class ServerProcessor:
|
|
| 138 |
break
|
| 139 |
sf = soundfile.SoundFile(io.BytesIO(raw_bytes), channels=1,endian="LITTLE",samplerate=SAMPLING_RATE, subtype="PCM_16",format="RAW")
|
| 140 |
audio, _ = librosa.load(sf,sr=SAMPLING_RATE)
|
| 141 |
-
out.append(audio)
|
| 142 |
if not out:
|
| 143 |
return None
|
| 144 |
return np.concatenate(out)
|
|
|
|
| 138 |
break
|
| 139 |
sf = soundfile.SoundFile(io.BytesIO(raw_bytes), channels=1,endian="LITTLE",samplerate=SAMPLING_RATE, subtype="PCM_16",format="RAW")
|
| 140 |
audio, _ = librosa.load(sf,sr=SAMPLING_RATE)
|
| 141 |
+
out.append(audio.astype('float32'))
|
| 142 |
if not out:
|
| 143 |
return None
|
| 144 |
return np.concatenate(out)
|