diff --git a/UI/UI.py b/UI/UI.py index bca5f9c9a010e1c71d6fbeb691072f0f0f377afa..ad9341fd2e61aa681da1c6eec46f4b5ccc8ff09f 100644 --- a/UI/UI.py +++ b/UI/UI.py @@ -1,9 +1,3 @@ -# -*- coding: utf-8 -*- -""" -Created on Mon Mar 29 20:54:18 2021 - -@author: Christoph -""" import tkinter as tk import pickle import numpy as np @@ -36,7 +30,8 @@ lsum.pack() opt = tk.OptionMenu(app, variable, *OptionList)#Drop-Down Menü opt.config(width=90, font=('Helvetica', 32)) opt.pack() - +ZielortID=[0,0,0,0,0,0,0,0,0,0,0,0] +Wochentag=[0,0,0,0,0,0,0] def berechne(): now = datetime.now() # aktuelle Zeit today = date.today()# aktuelles Datum @@ -48,12 +43,12 @@ def berechne(): Jahr=current_date[6:] Monat=current_date[3:5] Tag=current_date[0:2] - Wochentag=datetime.today().weekday() #Wochentag als Integer + Wochentag[datetime.today().weekday()]=1 #Wochentag als Integer for d in range(12): if (variable.get() == OptionList[d]): - ZielortID=d+2 + ZielortID[d]=1 loaded_model = pickle.load(open('model.sav', 'rb'))#Lade den finalen Random Forest - x_test=np.array([ZielortID,Jahr,Monat,Tag,Wochentag,Stunde,Minute]).reshape(1,-1) + x_test=np.array([Jahr,Monat,Tag,Stunde,Minute,Wochentag[0],Wochentag[1],Wochentag[2],Wochentag[3],Wochentag[4],Wochentag[5],Wochentag[6],ZielortID[0],ZielortID[1],ZielortID[2],ZielortID[3],ZielortID[4],ZielortID[5],ZielortID[6],ZielortID[7],ZielortID[8],ZielortID[9],ZielortID[10],ZielortID[11]]).reshape(1,-1) result = loaded_model.predict(x_test) # Prüfe wie lange es mit den Parametern dauert lsum["text"]='Sie benötigen: '+str(int(result/60))+' Minuten '+str(int(result%60))+' Sekunden' # ergänze die Zeit im Ergebnis-Label #print(str(result)[1:3]+' Minuten '+str(result)[3:5]+' Sekunden')