1+ from tkinter import *
2+ from tkinter import messagebox
3+ import backend
4+
5+
6+ def index_question_answer ():
7+ # for this, we are separating question and answer by "_"
8+ question_answer = index_question_answer_entry .get ()
9+ question , answer = question_answer .split ("_" )
10+ print (question )
11+ print (answer )
12+ va = backend .QuestionAnswerVirtualAssistant ()
13+ print (va .index_question_answer (question , answer ))
14+
15+ def provide_answer ():
16+ term = provide_answer_entry .get ()
17+ va = backend .QuestionAnswerVirtualAssistant ()
18+ print (va .provide_answer (term ))
19+
20+ if __name__ == "__main__" :
21+ root = Tk ()
22+ root .title ("Knowledge base" )
23+ root .geometry ('300x300' )
24+
25+ index_question_answer_label = Label (root , text = "Add question:" )
26+ index_question_answer_label .pack ()
27+ index_question_answer_entry = Entry (root )
28+ index_question_answer_entry .pack ()
29+
30+ index_question_answer_button = Button (root , text = "add" , command = index_question_answer )
31+ index_question_answer_button .pack ()
32+
33+ provide_answer_label = Label (root , text = "User Input:" )
34+ provide_answer_label .pack ()
35+ provide_answer_entry = Entry (root )
36+ provide_answer_entry .pack ()
37+
38+ search_term_button = Button (root , text = "ask" , command = provide_answer )
39+ search_term_button .pack ()
40+
41+ root .mainloop ()
0 commit comments