Created
June 12, 2021 13:34
-
-
Save KaushikShresth07/0ca455e4a6f0aff1f5c77e31241dbc79 to your computer and use it in GitHub Desktop.
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 speech_recognition as sr | |
| from googletrans import Translator # pip install googletrans==3.1.0a0 | |
| def TakeHindi(): | |
| command = sr.Recognizer() | |
| with sr.Microphone() as source: | |
| print("Listening......") | |
| command.pause_threshold = 1 | |
| audio = command.listen(source) | |
| try: | |
| print("Recognizing.....") | |
| query = command.recognize_google(audio,language='hi') | |
| print(f"You Said : {query}") | |
| except: | |
| return "none" | |
| return query.lower() | |
| def Tran(): | |
| line = TakeHindi() | |
| traslate = Translator() | |
| result = traslate.translate(line) | |
| Text = result.text | |
| return Text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment