def predictPneumoniaImg(top, predicted_output, pneumonia_presence_str,
                        image_name):
    classifier = Pneumonia_cnn.retrieveModel()
    if (Pneumonia_cnn.predictSingle(classifier, image_name.get())):
        # predictImg(predicted_ouput)
        pneumonia_presence_str.set("Pneumonia Present")
        ag = tk.Label(top,
                      textvariable=pneumonia_presence_str,
                      height=2,
                      width=20,
                      bg='red',
                      fg='blue',
                      font=("Helvetica", 20)).place(relx=0.33, rely=0.8)
        # ag['font'] = myfont
    else:
        pneumonia_presence_str.set("Pneumonia not Present")
        predicted_output.set("")
        # tk.Label(top, textvariable=predicted_output).place(relx=0.42, rely=0.16)
        fg = tk.Label(top,
                      textvariable=pneumonia_presence_str,
                      height=2,
                      width=20,
                      bg='red',
                      fg='blue',
                      font=("Helvetica", 20)).place(relx=0.33, rely=0.8)
def getAccuracy(top, accuracy):
    classifier = Pneumonia_cnn.retrieveModel()
    paccuracy = Pneumonia_cnn.getAccuracy(classifier)
    accuracy.set(paccuracy * 100)
    accuracyLabel = tk.Label(top,
                             textvariable=accuracy,
                             height=1,
                             width=15,
                             bg='yellow',
                             font=("Helvetica", 20)).place(relx=0.359,
                                                           rely=0.122)
def plotGraph(top):
    history = Pneumonia_cnn.loadHistory()
    acc = history['accuracy']
    # print(acc)
    val_acc = history['val_accuracy']

    loss = history['loss']
    val_loss = history['val_loss']
    Gui_graphplot.createWindowforGraph(top, acc, val_acc, loss, val_loss)
def generateModel(top):
    Pneumonia_cnn.savingModel()