-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce09da8
commit 174f44e
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from translate import Translator | ||
thisdict = { | ||
"Hindi": "hi", | ||
"Kannada": "kn", | ||
"Tamil": "ta", | ||
"Telugu": "te", | ||
"Urdu": "ur", | ||
"Malayalam":"ml", | ||
"Punjabi":"pa" | ||
} | ||
content=input('Enter content: ') | ||
lang=input("Enter language: ") | ||
translator= Translator(to_lang=thisdict[lang]) | ||
translation = translator.translate(content) | ||
print(translation) | ||
|
||
from gtts import gTTS #Import Google Text to Speech | ||
from IPython.display import Audio #Import Audio method from IPython's Display Class | ||
tts = gTTS(translation) #Provide the string to convert to speech | ||
tts.save('1.wav') #save the string converted to speech as a .wav file | ||
sound_file = '1.wav' | ||
Audio(sound_file, autoplay=True) | ||
|
||
n=int(input('Enter number of times to repeat every sentence: ')) | ||
from gtts import gTTS #Import Google Text to Speech | ||
from IPython.display import Audio #Import Audio method from IPython's Display Class | ||
tts = gTTS(content) #Provide the string to convert to speech | ||
tts.save('2.wav') #save the string converted to speech as a .wav file | ||
sound_file1 = '2.wav' | ||
Audio(sound_file1, autoplay=True) |