From d52c40f557d186c07a72211f1405942f1571c7ec Mon Sep 17 00:00:00 2001 From: majmongoose Date: Tue, 13 Feb 2024 07:03:42 -0500 Subject: [PATCH] Update pagebot.py --- pagebot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pagebot.py b/pagebot.py index 56a465f..ab663fc 100644 --- a/pagebot.py +++ b/pagebot.py @@ -49,7 +49,7 @@ def convert_to_mp4(mp3_file): def convert_to_text(mp3_path,mp3_name): print(mp3_path) try: - command = f'ffmpeg -i "{mp3_path}" {mp3_name}.wav' + command = f'ffmpeg -i "{mp3_path}" "{mp3_name}".wav' subprocess.run(command, shell=True) r = sr.Recognizer() # Load the audio file @@ -57,7 +57,7 @@ def convert_to_text(mp3_path,mp3_name): data = r.record(source) # Convert speech to text text = r.recognize_google(data) - os.remove("{mp3_name}.wav") + os.remove(f"{mp3_name}.wav") return (text) except Exception as e: print(f"Error during conversion: {e}")