Created
April 1, 2016 01:40
-
-
Save bitstein/1af2dca90b7b69f67c9965ea945f9fa3 to your computer and use it in GitHub Desktop.
ocr2speech21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import two1.mkt as mkt | |
image_url = "http://i.imgur.com/U86mtM1.png" | |
chinese_text = mkt.ocr2txt21.detect(image_url=image_url)['text'] | |
english_text = mkt.translate21.translate(text=chinese_text)['results'] | |
wavfile = mkt.txt2speech21.en({"text": english_text.strip()})['data'] | |
with open('output.wav', 'wb') as file: | |
file.write(base64.b64decode(wavfile)) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment