diff --git a/OS/01/conversations/user.json b/OS/01/conversations/user.json index 58ee757..92e81a2 100644 --- a/OS/01/conversations/user.json +++ b/OS/01/conversations/user.json @@ -1 +1 @@ -[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}] +[{"role": "user", "type": "message", "content": " Hey, how you doing?\n"}] \ No newline at end of file diff --git a/OS/01/stt.py b/OS/01/stt.py index 3d1ae2b..3929d06 100644 --- a/OS/01/stt.py +++ b/OS/01/stt.py @@ -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() - transcript = get_transcription_file(output_path) - print("Transcription result:", transcript) + 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"):