Reputation: 19
I AM FACING THE PROBLEM IN THIS PROJECT. THIS PROJECT WAS PROGRAMMED BY MY FRIEND BUT I NEED IT SO, HE GAVE ME BY SAVING THE FILE AND HE SEND THAT FILE FROM MAIL.
IT WAS RUNNING IN HIS PC WITHOUT ANY ERRORS BUT WHEN RUN THE PROGRAM IT DOSE'NT WORK .
from gtts import gTTS
import os
from playsound import playsound
from datetime import date
from datetime import datetime
playsound('welcome.mp3')
playsound('req.mp3')
r = sr.Recognizer()
#def SpeakText(command):6
# Initialize the engine
#engine.say(command)
#engine.runAndWait()
def hindi(cmmd):
speak=gTTS(text=cmmd, lang="hi", slow=False)
speak.save('vc.mp3')
playsound('vc.mp3')
os.remove('vc.mp3')
while(1):
# Exception handling to handle
# exceptions at the runtime
try:
# use the microphone as source for input.
with sr.Microphone() as source2:
# wait for a second to let the recognizer
# adjust the energy threshold based on
# the surrounding noise level
r.adjust_for_ambient_noise(source2, duration=0.2)
#listens for the user's input
audio2 = r.listen(source2)
# Using google to recognize audio
MyText = r.recognize_google(audio2 , language='hi-In')
MyText = MyText.lower()
print(MyText)
hindi(MyText)
if MyText=="आज क्या तारीख है":
#today = date.today()
#d1 = today.strftime("%d %b %Y")
d1=datetime.now()
a=d1.strftime("%d %b %Y %H:%M")
#a=(f"{a}")
print(a)
hindi(a)
if MyText=="आपको किसने बनाया":
print("मुझ को बनाने वाले का नाम अंशुल कुमार है")
hindi("मुझ को बनाने वाले का नाम अंशुल कुमार है")
if MyText=="तुमको किसने बनाया":
print("मुझ को बनाने वाले का नाम अंशुल कुमार है")
hindi("मुझ को बनाने वाले का नाम अंशुल कुमार है")
except sr.RequestError as e:
print("Could not request results; {0}".format(e))
except sr.UnknownValueError:
print("...........")`
`
Upvotes: 0
Views: 194