import streamlit as st import pandas as pd import numpy as np import pickle import os from data_processing import load_sample_data, preprocess_inputs from model_utils import load_model, predict_price # Set page config st.set_page_config( page_title="House Price Predictor", page_icon="🏠", layout="wide" ) # Load custom CSS def load_css(css_file): try: # Essayer avec UTF-8 explicitement with open(css_file, 'r', encoding='utf-8') as f: css = f.read() return css except UnicodeDecodeError: # Fallback sur une autre encodage si UTF-8 échoue try: with open(css_file, 'r', encoding='latin-1') as f: css = f.read() return css except Exception as e: return None try: css = load_css('style.css') if css: st.markdown(f'', unsafe_allow_html=True) else: # Si le fichier CSS ne peut pas être chargé, ajouter un style minimal inline st.markdown(""" """, unsafe_allow_html=True) except Exception as e: st.write(f"Erreur lors du chargement du CSS (mode dégradé activé): {e}") # Custom styling for specific components st.markdown(""" """, unsafe_allow_html=True) # Title and description with custom styling st.markdown('
Cette application vous permet de prédire le prix des propriétés en utilisant un modèle XGBoost pré-entraîné.
', unsafe_allow_html=True) # Load sample data for statistics sample_data = load_sample_data() # Sidebar for model upload and data statistics with st.sidebar: st.markdown(""" """, unsafe_allow_html=True) # Model upload section st.markdown('Min: ${:,.2f} | Max: ${:,.2f}
Mean: ${:,.2f} | Median: ${:,.2f}