import joblib import os import numpy as np # file_path = os.path.abspath("first_simple_linear_regression.pkl") current_file_path = os.path.abspath(__file__) current_folder_path = os.path.dirname(current_file_path) model_filename = f'{current_folder_path}\\first_simple_linear_regression.pkl' def load_model_and_predict(x_value): #This function loads the model and predict the y values #Load the model loaded_model = j100oblib.load(model_filename) x_value = np.array([x_value]).reshape(-1,1) predicted_y = loaded_model.predict(x_value)[0] return predicted_y end_val = "0" print("Bienvenido!") while(end_val!="1"): x_proposed_value = int(input("Enter your x value: ")) predicted_y = load_model_and_predict(x_proposed_value) print(f"Your y returne values is {predicted_y}") end_val = input("Press one to end, or enter any key to predict anothe y value")