diff --git a/app.py b/app.py index 09a3c69..bb37005 100644 --- a/app.py +++ b/app.py @@ -3,17 +3,17 @@ from pytesseract import image_to_string -def image_to_sound(path_to_image): +def image_to_sound(): """ Function for converting an image to sound """ try: - loaded_image = Image.open(path_to_image) + loaded_image = Image.open("./image.jpg") decoded_text = image_to_string(loaded_image) cleaned_text = " ".join(decoded_text.split("\n")) print(cleaned_text) - sound = gTTS(cleaned_text, lang="en") - sound.save("sound.mp3") + sound = gTTS(cleaned_text, lang="en",tld='com') + sound.save("sound_test_2.mp3") return True except Exception as bug: print("The bug thrown while excuting the code\n", bug) @@ -21,5 +21,5 @@ def image_to_sound(path_to_image): if __name__ == "__main__": - image_to_sound("image.jpg") - input() \ No newline at end of file + image_to_sound() + input() diff --git a/sound_test_2.mp3 b/sound_test_2.mp3 new file mode 100644 index 0000000..f39fd0d Binary files /dev/null and b/sound_test_2.mp3 differ