From 6d3a4d9dc1311d90f722e116c815f4567f85df10 Mon Sep 17 00:00:00 2001 From: Piotr Date: Tue, 17 Oct 2023 18:36:06 +0200 Subject: [PATCH] Integrate regression model --- interface.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/interface.py b/interface.py index 98552bd..47b64cc 100644 --- a/interface.py +++ b/interface.py @@ -1,5 +1,8 @@ from tkinter import * from tkinter import messagebox +import pickle +import numpy as np +from sklearn.preprocessing import StandardScaler window = Tk() window.minsize(width=600, height=600) @@ -37,6 +40,7 @@ wartosc_regresji = Label() wartosc_regresji.config(text="Wartosć przewidywana", background="#ffffff") wartosc_regresji.grid(column=1, row=4, sticky='w') +model = pickle.load(open("model.pkl", 'rb')) def val_numbers(): @@ -50,8 +54,13 @@ def val_numbers(): messagebox.showinfo(title="Error", message=f"Please provide numbers between 0 to 100 for floors and 0 to 100.000 for metric area.") else: confirm = messagebox.askyesno(title="Confirm", message="Do you want to start prediction?") - - + if confirm == True: + array = np.array([[int(pietro_entry.get()),float(metraz_entry.get())]]) + scaler = StandardScaler() + transformed_data = scaler.fit_transform(array) + prediction = model.predict(transformed_data) + wartosc_regresji.config(text=f'{round(prediction[0][0], 2)} PLN') + start_button = Button(command=val_numbers) start_button.config(text="Start", background="#000000", foreground="#ffffff")