"Dashboard" design for progress meters.
Dashboard type of design that includes 20 Progress Meters. Able to see the progess meters after they have competed.
This commit is contained in:
parent
595b3c0993
commit
17d87870e7
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as gui
|
import PySimpleGUI as g
|
||||||
from chatterbot import ChatBot
|
from chatterbot import ChatBot
|
||||||
import chatterbot.utils
|
import chatterbot.utils
|
||||||
|
|
||||||
|
@ -9,10 +9,34 @@ The GUI is used to show progress bars during the training process and
|
||||||
to collect user input that is sent to the chatbot. The reply is displayed in the GUI window
|
to collect user input that is sent to the chatbot. The reply is displayed in the GUI window
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# redefine the chatbot text based progress bar with a graphical one
|
# Create the 'Trainer GUI'
|
||||||
def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20):
|
MAX_PROG_BARS = 20
|
||||||
gui.EasyProgressMeter(description, iteration_counter, total_items)
|
bars = []
|
||||||
|
texts = []
|
||||||
|
training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))]]
|
||||||
|
for i in range(MAX_PROG_BARS):
|
||||||
|
bars.append(g.ProgressBar(100, size=(30, 5)))
|
||||||
|
texts.append(g.T(' '*20))
|
||||||
|
training_layout += [[texts[i], bars[i]]]
|
||||||
|
|
||||||
|
training_form = g.FlexForm('Training')
|
||||||
|
training_form.Layout(training_layout)
|
||||||
|
current_bar = 0
|
||||||
|
|
||||||
|
# callback function for training runs
|
||||||
|
def print_progress_bar(description, iteration_counter, total_items, progress_bar_length=20):
|
||||||
|
global current_bar
|
||||||
|
global bars
|
||||||
|
global texts
|
||||||
|
global training_form
|
||||||
|
# update the form and the bars
|
||||||
|
training_form.ReadNonBlocking()
|
||||||
|
bars[current_bar].UpdateBar(iteration_counter, max=total_items)
|
||||||
|
texts[current_bar].Update(description)
|
||||||
|
if iteration_counter == total_items:
|
||||||
|
current_bar += 1
|
||||||
|
|
||||||
|
# redefine the chatbot text based progress bar with a graphical one
|
||||||
chatterbot.utils.print_progress_bar = print_progress_bar
|
chatterbot.utils.print_progress_bar = print_progress_bar
|
||||||
|
|
||||||
chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer')
|
chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTrainer')
|
||||||
|
@ -21,10 +45,10 @@ chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTr
|
||||||
chatbot.train("chatterbot.corpus.english")
|
chatbot.train("chatterbot.corpus.english")
|
||||||
|
|
||||||
################# GUI #################
|
################# GUI #################
|
||||||
with gui.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form:
|
with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form:
|
||||||
layout = [ [gui.Output(size=(80, 20))],
|
layout = [[g.Output(size=(80, 20))],
|
||||||
[gui.Multiline(size=(70, 5), enter_submits=True),
|
[g.Multiline(size=(70, 5), enter_submits=True),
|
||||||
gui.ReadFormButton('SEND', bind_return_key=True), gui.SimpleButton('EXIT')]]
|
g.ReadFormButton('SEND', bind_return_key=True), g.SimpleButton('EXIT')]]
|
||||||
|
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
# ---===--- Loop taking in user input and using it to query HowDoI web oracle --- #
|
# ---===--- Loop taking in user input and using it to query HowDoI web oracle --- #
|
||||||
|
|
Loading…
Reference in New Issue