Skip to content
Snippets Groups Projects
Commit 7ff4d7b7 authored by Christoph Olberding's avatar Christoph Olberding
Browse files

Update UI/UI.py

parent 0d0541ad
Branches
No related tags found
No related merge requests found
# -*- 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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment