mirror of
https://github.com/majmongoose/PageBot.git
synced 2024-11-23 12:58:38 -05:00
Update pagebot.py
This commit is contained in:
parent
df4ca14b9c
commit
d52c40f557
@ -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}")
|
||||
|
Loading…
Reference in New Issue
Block a user