-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchatbot.py
51 lines (46 loc) · 1.19 KB
/
chatbot.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from chatterbot import Chatbot
from chatterbot.trainers import ListTrainer
from tkinter import*
bot=Chatbot("Newton")
convo={
"hiii"
"hello..."
"what is name??"
"My name is Newton !!!"
"Who are you ?"
"I am Newton a Chat bot."
"Which language do you speak?"
"I gernally speak in english."
"In which language are code in??"
"I am code in python."
"Sorry !!!"
"Thanku:)"
"Where do you live?"
"I use to live in your device:)"
}
trainer=ListTrainer(bot)
trainer=train(convo)
main=TK()
main.geometry("500x600")
main.title("Education ChatBOT")
img=PhotoImage(file="bot1.pnj")
Photol=Label(main,image=img)
Photol.pack(pady=5)
def ask_from_bot():
print("click")
query=textF.get()
answer=bot.get_response(query)
msgs.insert(END,"You:"+query)
msgs.insert(END,"Newton:"+str(answer))
TestF.delete(0,END)
frame=Frame(main)
sc=scrollbar(frame)
msgs=Listbox(frame,width=80,height=20)
sc.pack(side=RIGHT,fill=Y)
msgs.pack(side=LEFT,fill=BOTH,pady=10)
frame.pack()
textF=Entry(main,font=("Lucida Sans",20))
textF.pack(fill=x,pady=10)
btn=Buttom(main,text="Ask From Newton",font=("Lucida Sans",20),command=ask_from_bot)
btn.pack()
main.mainloop()