This commit is contained in:
yumoqing 2024-09-04 19:07:29 +08:00
parent 08369052c5
commit f30df5a6e0

View File

@ -19,7 +19,6 @@ def save_base64_wav(base64_data, output_file,sample_rate=16000, num_channels=1):
wf.setnchannels(num_channels) # Mono channel wf.setnchannels(num_channels) # Mono channel
wf.setsampwidth(2) # 16-bit sample width wf.setsampwidth(2) # 16-bit sample width
wf.setframerate(sample_rate) # 44.1 kHz sample rate wf.setframerate(sample_rate) # 44.1 kHz sample rate
# Write the decoded data to the WAV file # Write the decoded data to the WAV file
wf.writeframes(wav_data) wf.writeframes(wav_data)
@ -36,6 +35,7 @@ async def generate(request, kw):
} }
audio_file = temp_file(suffix='.wav') audio_file = temp_file(suffix='.wav')
save_base64_wav(audio, audio_file) save_base64_wav(audio, audio_file)
engine = None engine = None
g = ServerEnv() g = ServerEnv()
if model=='whisper': if model=='whisper':