nit: remove temp output file

pull/11/head
Shiven Mian 11 months ago
parent 43108e931d
commit c9b3608b38

@ -1 +1 @@
[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}]
[{"role": "user", "type": "message", "content": " Hey, how you doing?\n"}]

@ -88,10 +88,13 @@ def stt_wav(wav_file_path: str):
return transcript
else:
temp_dir = tempfile.gettempdir()
output_path = os.path.join(temp_dir, f"output_{datetime.now().strftime('%Y%m%d%H%M%S%f')}.wav")
output_path = os.path.join(temp_dir, f"output_stt_{datetime.now().strftime('%Y%m%d%H%M%S%f')}.wav")
ffmpeg.input(wav_file_path).output(output_path, acodec='pcm_s16le', ac=1, ar='16k').run()
try:
transcript = get_transcription_file(output_path)
print("Transcription result:", transcript)
finally:
os.remove(output_path)
return transcript
def stt(input_data, mime_type="audio/wav"):

Loading…
Cancel
Save