github taki diğer kullanıcıların yaptıklarınada baktım yüksek ihtimal basit bi durum ama hata alıyorum
`import speech_recognition as sr
from datetime import datetime
import webbrowser
import time
from gtts import gTTS
import playsound
import random
import os
r = sr.Recognizer()
def record(ask = False):
with sr.Microphone() as source:
if ask:
speak(ask)
audio = r.listen(source)
voice = “”
try:
voice = r.recognize_google(audio , language=‘tr-TR’)
except sr.UnknownValueError:
speak(‘anlayamadım’)
except sr.RequestError:
speak(‘sistem çalışmıyor’)
return voice
def speak(string):
tts = gTTS(string,lang=‘tr’)
rand = random.randint(1,1000)
file = ‘audio-’+str(rand)+’.mp3’
tts.save(file)
playsound(file)
os.remove(file)
def response(voice):
if “edit” in voice:
speak(“dinliyorum”)
print(“dinliyorum”)
if “güncelleştirmeleri denetle” in voice:
speak(“ilgileniyorum”)
print(“ilgileniyorum”)
os.system(‘start cmd /k pip install requirements.txt’)
if "arayüzü aç" in voice:
speak("editi uyandırıyorum")
os.system('start cmd /k python Tkinter_dashboard.py')
if "uyan" in voice:
speak("selam patron")
if 'nasılsın' in voice:
speak('iyiyim Teşekkür Ederim sen nasılsın')
if 'saat kaç' in voice:
speak(datetime.now().strftime('%H:%M:%S'))
if 'arama yap' in voice:
search = record('ne aramak istersin')
url = 'https://google.com/search?q='+search
webbrowser.get().open(url)
speak(search + ' için bulduklarım')
if 'kapat' in voice:
exit()
time.sleep(1)
while 1:
voice = record()
print(voice)
response(voice)`