diff --git a/models/lasso_model (1).sav b/models/lasso_model (1).sav new file mode 100644 index 0000000..9500bff Binary files /dev/null and b/models/lasso_model (1).sav differ diff --git a/streamlit_tutorial.py b/streamlit_tutorial.py index 3b41e2c..f571ee6 100644 --- a/streamlit_tutorial.py +++ b/streamlit_tutorial.py @@ -1,29 +1,47 @@ import streamlit as st +import joblib +model_path = 'models/lasso_model.sav' from streamlit_extras.switch_page_button import switch_page +import random def main(): - st.title('Bienvenido al portal predictivo de la empresa XYZ') - st.write('**Por favor seleccione el servicio predictivo que desea utilizar**') + st.title('Bienvenido al portal de Seguros "Securitas"') + st.write('**Aquí se puede calcular el precio anual de prima que se pagará**') - opcion = st.radio('Seleccione el servicio:', - ('Predicción del tipo de flor (con CSV)', 'Predicción del tipo de flor (manualmente)', 'Predicción de imagen','Maqueta','Sliders'), - index=0, - key='option') + # Añadir un selector de fecha + publish_date = st.date_input("Quotation Date") + # Diccionario para almacenar los datos de entrada + input_data = {} + # Widget de entrada numérica para cada característica + edad = st.number_input('Type your Age: ', min_value=0, max_value=99) + # Sexo + sexo = st.selectbox('Select your Gender: ',('Male','Female')) + # BMI + bmi = st.number_input('Insert you BMI:', format="%0.2f", value="min", min_value=15.0, max_value=50.00) + # Fumador + fumador = st.selectbox('Do you smoke?: ',('Yes','No')) + # Hijos + hijos = st.slider('Choose your number of children: ', min_value=0, max_value=9) + # Calcular precio cuando se pulsa el botón + if st.button("Calculate Price"): + precio = random.randint(1000, 1500) + st.write(f"el precio de tu seguro es: {precio} Euros") + + - if st.button('Empezar!'): - route_prediction(opcion) +def load_model(model_path): + try: + model = joblib.load(model_path) # cargar el modelo .sav + return model + except Exception as e: + st.error(f"Error loading model: {e}") + return None -def route_prediction(opcion): - if opcion == 'Predicción del tipo de flor (con CSV)': - switch_page("pred_iris_csv") - elif opcion == 'Predicción del tipo de flor (manualmente)': - switch_page("pred_iris_man") - elif opcion == 'Predicción de imagen': - switch_page("pred_imagen") - elif opcion == 'Maqueta': - switch_page("maqueta") - elif opcion == 'Sliders': - switch_page("sliders") +# with open(model_path, 'rb') as file: +# model = pickle.load(file) +# with st.spinner("Generando historia..."): +# response = get_text_response(text_model_pro, prompt, config) +# st.write(response) if __name__ == "__main__": main()