diff --git a/Gui.py b/Gui.py new file mode 100644 index 0000000..9b1074e --- /dev/null +++ b/Gui.py @@ -0,0 +1,79 @@ +# Import Module +from tkinter import * +import pickle +import pandas as pd +import numpy as np + +#Styl +tlo = "grey" +guziki = "#60839D" + +# Create Object +root = Tk() +root.geometry('1000x600') +root.configure(bg=tlo) + +def update(): + dane = [address1.__getattribute__,address2.__getattribute__,address3.__getattribute__] + return None + +#Wczytanie modelu +model = pickle.load(open('mieszkania_model', 'rb')) + +def cena_mieszkania(pokoje, metraz, rok): + mieszkanie = pd.DataFrame([[pokoje, metraz, rok]], columns=['pokoje', 'metraz', 'rok']) + cena = model.predict(mieszkanie).item() + return np.round(cena, 2) + +# Funkcja tworzy nowe okno ktore wyswietla predykcje ceny +def Oblicz(): + newWindow = Toplevel(root) + newWindow.geometry('600x300') + newWindow.title("wynik") + newWindow.config(bg=tlo) + + # okno + T4 = Label(newWindow,bg=tlo,fg="white",height=3,width=37, text = "Potencjalna cena mieszkania:", bd = 0, relief=RAISED).place(x = 100, y= 50) + address1 = Label(newWindow,width=37,height=3,bg=guziki,text = wyznacz_cene()).place(x = 100, y= 100) + update() + return None + +def reset(): + return None + +Button(root,text="Oblicz",font="arial 20 bold",command=Oblicz ).place(x= 800, y=500) + +#Pola do wpisywania + + +# metraż + +address1 = Text(root,width=37,height=3,bg=guziki) +address1.place(x = 100, y= 100) +T = Label(root,bg=tlo,fg="white",height=3,width=37, text = "Liczba Pokoi", bd = 0, relief=RAISED).place(x = 100, y= 50) + + +# liczba pokoi +address2 = Text(root,width=37,height=3,bg=guziki) +address2.place(x = 100, y= 200) + +T2 = Label(root,bg=tlo,fg="white",height=3,width=37, text = "Metraż", bd = 0, relief=RAISED).place(x = 100, y= 150) + +# Rok budowy +address3 = Text(root,width=37,height=3,bg=guziki) +address3.place(x = 100, y= 300) + +T3 = Label(root,bg=tlo,fg="white",height=3,width=37, text = "Rok Budowy", bd = 0, relief=RAISED).place(x = 100, y= 250) + +Output = Text(root, height = 5, + width = 25, + bg = tlo) + +def wyznacz_cene(): + pokoje = address1.get("1.0",END) + metraz = address2.get("1.0",END) + rok = address3.get("1.0",END) + return cena_mieszkania(pokoje,metraz,rok) + +# Execute Tkinter +root.mainloop() \ No newline at end of file diff --git a/SysInf.ipynb b/SysInf.ipynb index 14f6dc1..cb489b8 100644 --- a/SysInf.ipynb +++ b/SysInf.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -66,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -452,7 +452,7 @@ "[2547 rows x 26 columns]" ] }, - "execution_count": 121, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -470,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -479,7 +479,7 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -865,7 +865,7 @@ "[462 rows x 25 columns]" ] }, - "execution_count": 123, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -876,7 +876,7 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -885,7 +885,7 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -979,7 +979,7 @@ "[462 rows x 1 columns]" ] }, - "execution_count": 125, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -997,7 +997,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -1006,7 +1006,7 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -1392,7 +1392,7 @@ "[418 rows x 25 columns]" ] }, - "execution_count": 127, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -1410,7 +1410,7 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -1419,7 +1419,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -1428,7 +1428,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -1437,7 +1437,7 @@ }, { "cell_type": "code", - "execution_count": 131, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -1453,7 +1453,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -1462,7 +1462,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -1471,7 +1471,7 @@ }, { "cell_type": "code", - "execution_count": 134, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -1494,7 +1494,7 @@ }, { "cell_type": "code", - "execution_count": 135, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -1503,7 +1503,7 @@ }, { "cell_type": "code", - "execution_count": 136, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -1512,7 +1512,7 @@ }, { "cell_type": "code", - "execution_count": 137, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -1521,7 +1521,7 @@ }, { "cell_type": "code", - "execution_count": 138, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -1530,7 +1530,7 @@ }, { "cell_type": "code", - "execution_count": 139, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -1540,7 +1540,7 @@ }, { "cell_type": "code", - "execution_count": 140, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -1643,7 +1643,7 @@ "max 6.000000e+06 11.000000 404.000000 2022.000000" ] }, - "execution_count": 140, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1654,7 +1654,7 @@ }, { "cell_type": "code", - "execution_count": 141, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -1784,7 +1784,7 @@ "[1763 rows x 4 columns]" ] }, - "execution_count": 141, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -1802,7 +1802,7 @@ }, { "cell_type": "code", - "execution_count": 142, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -1905,7 +1905,7 @@ "max 2.318580e+06 6.000000 234.200000 2021.000000" ] }, - "execution_count": 142, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1916,7 +1916,7 @@ }, { "cell_type": "code", - "execution_count": 143, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -1925,7 +1925,7 @@ }, { "cell_type": "code", - "execution_count": 144, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -1934,7 +1934,7 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ @@ -1943,7 +1943,7 @@ }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -1952,7 +1952,7 @@ }, { "cell_type": "code", - "execution_count": 147, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -1962,7 +1962,7 @@ }, { "cell_type": "code", - "execution_count": 148, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -2092,7 +2092,7 @@ "[320 rows x 4 columns]" ] }, - "execution_count": 148, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -2110,7 +2110,7 @@ }, { "cell_type": "code", - "execution_count": 149, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -2119,7 +2119,7 @@ }, { "cell_type": "code", - "execution_count": 150, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -2128,7 +2128,7 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -2138,7 +2138,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 43, "metadata": {}, "outputs": [ { @@ -2241,7 +2241,7 @@ "max 6.000000e+06 11.000000 404.000000 2022.000000" ] }, - "execution_count": 152, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -2259,7 +2259,7 @@ }, { "cell_type": "code", - "execution_count": 153, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ @@ -2275,7 +2275,7 @@ }, { "cell_type": "code", - "execution_count": 154, + "execution_count": 45, "metadata": {}, "outputs": [], "source": [ @@ -2285,7 +2285,7 @@ }, { "cell_type": "code", - "execution_count": 155, + "execution_count": 46, "metadata": {}, "outputs": [], "source": [ @@ -2295,7 +2295,7 @@ }, { "cell_type": "code", - "execution_count": 156, + "execution_count": 47, "metadata": {}, "outputs": [], "source": [ @@ -2311,7 +2311,7 @@ }, { "cell_type": "code", - "execution_count": 157, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ @@ -2320,19 +2320,19 @@ }, { "cell_type": "code", - "execution_count": 158, + "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()