Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import speech_recognition as sr
- from tkinter import *
- window = Tk()
- window.title('Чат бот')
- window.geometry('800x500')
- label = Label(window, text='', font=('', 10))
- label.place(x=0, y=100)
- def speak():
- r = sr.Recognizer()
- with sr.Microphone() as source:
- r.adjust_for_ambient_noise(source)
- window.title('Скажите текст')
- window.update()
- data = r.record(source, duration=5)
- text = r.recognize_google(data, language='ru')
- label['text'] = text
- window.title('Чат бот')
- Button(window, text='Начать говорить', command=speak).place(x=240, y=300)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment