Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
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)
return


if __name__ == "__main__":
image_to_sound("image.jpg")
input()
image_to_sound()
input()
Binary file added sound_test_2.mp3
Binary file not shown.