koiking213 2024-02-20
specify audio dtype
@62119464db1e0f5f30fc3b7973f3331df791af05
whisper_online.py
--- whisper_online.py
+++ whisper_online.py
@@ -11,7 +11,7 @@
 @lru_cache
 def load_audio(fname):
     a, _ = librosa.load(fname, sr=16000)
-    return a
+    return a.astype('float32')
 
 def load_audio_chunk(fname, beg, end):
     audio = load_audio(fname)
whisper_online_server.py
--- whisper_online_server.py
+++ whisper_online_server.py
@@ -138,7 +138,7 @@
                 break
             sf = soundfile.SoundFile(io.BytesIO(raw_bytes), channels=1,endian="LITTLE",samplerate=SAMPLING_RATE, subtype="PCM_16",format="RAW")
             audio, _ = librosa.load(sf,sr=SAMPLING_RATE)
-            out.append(audio)
+            out.append(audio.astype('float32'))
         if not out:
             return None
         return np.concatenate(out)
Add a comment
List