快来!建立你的第一个Python聊天机器人项目
ChatBox.insert(END, "You: " + msg+ 'nn') ChatBox.config(foreground="#446665", font=("Verdana", 12 )) ints= predict_class(msg) res= getResponse(ints,intents) ChatBox.insert(END, "Bot: " + res+ 'nn') ChatBox.config(state=DISABLED) ChatBox.yview(END) root= Tk() root.title("Chatbot") root.geometry("400x500" root.resizable(width=FALSE, height=FALSE) #Create Chat window ChatBox= Text(root, bd=0, bg="white",height="8", width="50", font="Arial",) ChatBox.config(state=DISABLED) #Bind scrollbar to Chat window scrollbar= Scrollbar(root,command=ChatBox.yview, cursor="heart") ChatBox['yscrollcommand'] = scrollbar.set #Create Button to send message SendButton = Button(root,font=("Verdana",12,'bold'),text="Send", width="12", height=5, bd=0,bg="#f9a602",activebackground="#3c9d9b",fg='#000000', command=send ) #Create the box to enter message EntryBox= Text(root, bd=0, bg="white",width="29", height="5", font="Arial") #EntryBox.bind("<Return>",send) #Place all components on the screen scrollbar.place(x=376,y=6, height=386) ChatBox.place(x=6,y=6, height=386,width=370) EntryBox.place(x=128,y=401, height=90,width=265) SendButton.place(x=6,y=401, height=90) root.mainloop() 运行聊天机器人 现在有两个独立的文件,一个是train_chatbot.py,首先使用它来训练模型。 pythontrain_chatbot.py (编辑:站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- iphone se与iphone5s哪个好 iphone se与iphone5s区别详细介
- 街头篮球手游怎么盖帽 街头篮球手游盖帽技巧
- 腾讯优品是什么 腾讯优品怎么开店
- Flex4 DataGrid中嵌入RadioButton实现思路及代码
- Apple Pay新增支持哪三家银行 Apple Pay还会新增支持哪些银
- nice直播怎么直播 nice直播在哪里
- Nginx的这些妙用,你肯定有不知道的!
- iPhone4s可以升级iOS9.3.2吗 iPhone4s升级iOS9.3.2怎么样
- 服务商转正非一朝一夕 积累造车经验或许拥有更好站位
- iphonex廉价版和iphonex的区别 廉价版iphonex和iphonex区别