This commit is contained in:
Paulina Kijewska 2023-10-24 18:53:10 +02:00
commit 6feee7a0ce
3 changed files with 63 additions and 3 deletions

View File

@ -1,7 +1,32 @@
from tkinter import *
import joblib
import pandas as pd
root = Tk()
def calculate_price():
# Get the selected values and entry input
stan = selected_stan.get()
liczba_pokoi = selected_liczba_pokoi.get()
metraz = entry1.get()
rynek = selected_rynek.get()
# Create a dictionary with the data
data = {'stan': [stan], 'l pokoi': [liczba_pokoi], 'metraż': [metraz], 'rynek': [rynek]}
# Create a DataFrame from the dictionary
X = pd.DataFrame(data)
# Load the model and make predictions
loaded_model = joblib.load('ridge_model.sav')
result = loaded_model.predict(X)
result = result / float(metraz)
# Display the result
result_label.config(text=f"Predicted Price: {result[0]:.2f} PLN")
result_label.grid(row=6, column=1, padx=10, pady=5)
root.geometry("500x500")
root.title("Mieszkaneo")
@ -15,7 +40,7 @@ entry1.grid(row=1, column=0, padx=10, pady=5)
label2 = Label(root, text="Rynek", font=('Arial', 18))
label2.grid(row=0, column=1, padx=10, pady=5)
rynek_options = ["Pierwotny", "Wtórny"]
rynek_options = ["pierwotny", "wtórny"]
selected_rynek = StringVar()
selected_rynek.set(rynek_options[0])
@ -25,7 +50,7 @@ rynek_menu.grid(row=1, column=1, padx=10, pady=5)
label3 = Label(root, text="Stan", font=('Arial', 18))
label3.grid(row=2, column=0, padx=10, pady=5)
stan_options = ["Do remontu", "Wykończone"]
stan_options = ["do zamieszkania", "do wykończenia","do remontu"]
selected_stan = StringVar()
selected_stan.set(stan_options[0])
@ -43,8 +68,12 @@ liczba_pokoi_menu = OptionMenu(root, selected_liczba_pokoi, *liczba_pokoi_option
liczba_pokoi_menu.config(font=('Arial', 18), bg='white', fg='black') # Kolory tła i tekstu
liczba_pokoi_menu.grid(row=3, column=1, padx=10, pady=5)
button = Button(root, text="Oblicz cenę mieszkania", font=('Arial', 18))
button = Button(root, text="Oblicz cenę mieszkania", font=('Arial', 18), command=calculate_price)
button.config(bg='green', fg='white') # Kolory tła i tekstu
button.grid(row=4, columnspan=2, padx=10, pady=10)
result_label = Label(root, text="", font=('Arial', 18))
result_label.grid(row=5, columnspan=2, padx=10, pady=5)
root.mainloop()

23
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,23 @@
pipeline {
agent {
docker { image 'python:3.10.6-slim-bullseye' }
}
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
sh 'check_flat_price.py'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}

8
check_flat_price.py Normal file
View File

@ -0,0 +1,8 @@
import pandas as pd
import numpy as np
ceny = pd.read_csv('expected.tsv', sep='\t', header=None)
for cena in ceny:
if cena < 0:
print("cena ujemna, sprawdz cene")