Spaces:
Runtime error
Runtime error
File size: 1,635 Bytes
a95d27d 7ae1c4f a95d27d 7ae1c4f a95d27d 7ae1c4f a95d27d 7ae1c4f a95d27d 7ae1c4f a95d27d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import speech_recognition as sr
from gtts import gTTS
import os
from langchain_community.tools import DuckDuckGoSearchRun
# मान लें कि आपका कोडिंग मॉडल यहाँ कनेक्टेड है
search = DuckDuckGoSearchRun()
def speak(text):
# हकलाने की समस्या को रोकने के लिए शब्दों को साफ़ बोलना
# डॉट और कोमा का सही उपयोग करते हुए
tts = gTTS(text=text, lang='hi')
tts.save("response.mp3")
os.system("start response.mp3") # विंडोज के लिए, मोबाइल के लिए अलग कमांड होगा
def listen_for_wake_word():
recognizer = sr.Recognizer()
with sr.Microphone() as source:
print("शिव एआई सुन रहा है... 'Shiv AI' बोलें")
audio = recognizer.listen(source)
try:
command = recognizer.recognize_google(audio, language='en-in')
if "shiv ai" in command.lower():
return True
except:
return False
# मुख्य लूप (हमेशा एक्टिव रहने के लिए)
while True:
if listen_for_wake_word():
speak("जी श्री राम नाग जी , आज्ञा दें। मैं आपकी क्या सहायता कर सकता हूँ ?")
# यहाँ पर आपका कोडिंग और सर्च वाला लॉजिक शुरू होगा
|