Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,9 +7,10 @@ import numpy as np
|
|
| 7 |
model = joblib.load('Rf_model.joblib')
|
| 8 |
encoder = joblib.load('encoder_d.joblib')
|
| 9 |
|
| 10 |
-
# Custom CSS
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
|
|
|
| 13 |
.main-title {
|
| 14 |
background-color: #007BFF;
|
| 15 |
padding: 10px;
|
|
@@ -18,40 +19,34 @@ st.markdown("""
|
|
| 18 |
text-align: center;
|
| 19 |
font-size: 28px;
|
| 20 |
}
|
|
|
|
|
|
|
| 21 |
.stApp {
|
| 22 |
background-image: url('https://images.unsplash.com/photo-1605902711622-cfb43c4437d1');
|
| 23 |
background-size: cover;
|
| 24 |
}
|
| 25 |
-
</style>
|
| 26 |
-
""", unsafe_allow_html=True)
|
| 27 |
-
|
| 28 |
-
# Streamlit app
|
| 29 |
-
def main():
|
| 30 |
-
st.markdown('<div class="main-title">Insurance Cost Prediction App</div>', unsafe_allow_html=True)
|
| 31 |
-
st.markdown("##")
|
| 32 |
-
|
| 33 |
-
# Two row layout using columns
|
| 34 |
-
col1, col2, col3 = st.columns(3)
|
| 35 |
-
with col1:
|
| 36 |
-
age = st.number_input("Age", min_value=18, max_value=100, value=30)
|
| 37 |
-
bmi = st.number_input("BMI", min_value=10.0, max_value=50.0, value=25.0)
|
| 38 |
-
|
| 39 |
-
with col2:
|
| 40 |
-
sex = st.selectbox("Sex", encoder["sex"].classes_)
|
| 41 |
-
sex = encoder['sex'].transform([sex])[0]
|
| 42 |
-
children = st.number_input("Children", min_value=0, max_value=10, value=0)
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
model = joblib.load('Rf_model.joblib')
|
| 8 |
encoder = joblib.load('encoder_d.joblib')
|
| 9 |
|
| 10 |
+
# Custom CSS
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
+
/* App title */
|
| 14 |
.main-title {
|
| 15 |
background-color: #007BFF;
|
| 16 |
padding: 10px;
|
|
|
|
| 19 |
text-align: center;
|
| 20 |
font-size: 28px;
|
| 21 |
}
|
| 22 |
+
|
| 23 |
+
/* App background */
|
| 24 |
.stApp {
|
| 25 |
background-image: url('https://images.unsplash.com/photo-1605902711622-cfb43c4437d1');
|
| 26 |
background-size: cover;
|
| 27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
/* Input fields background */
|
| 30 |
+
.stNumberInput, .stSelectbox {
|
| 31 |
+
background-color: rgba(255, 255, 255, 0.8) !important;
|
| 32 |
+
border-radius: 10px;
|
| 33 |
+
padding: 5px;
|
| 34 |
+
}
|
| 35 |
|
| 36 |
+
/* Predict Button */
|
| 37 |
+
div.stButton > button {
|
| 38 |
+
background-color: #28a745;
|
| 39 |
+
color: white;
|
| 40 |
+
font-size: 18px;
|
| 41 |
+
width: 50%;
|
| 42 |
+
margin: auto;
|
| 43 |
+
display: block;
|
| 44 |
+
border-radius: 8px;
|
| 45 |
+
}
|
| 46 |
|
| 47 |
+
/* Output style */
|
| 48 |
+
.result-box {
|
| 49 |
+
background-color: rgba(255,255,255,0.85);
|
| 50 |
+
border-left: 6px solid #28a745;
|
| 51 |
+
padding: 15px;
|
| 52 |
+
font-size:
|