Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -87,24 +87,75 @@ st.markdown("""
|
|
| 87 |
border: 1px solid rgba(255,255,255,0.2);
|
| 88 |
}
|
| 89 |
|
| 90 |
-
/* Input
|
| 91 |
.stSelectbox label, .stSlider label {
|
| 92 |
-
font-family: 'Inter', sans-serif;
|
| 93 |
-
font-weight: 600;
|
| 94 |
-
color: #
|
| 95 |
-
font-size: 1rem;
|
| 96 |
-
margin-bottom: 0.5rem;
|
|
|
|
| 97 |
}
|
| 98 |
|
|
|
|
| 99 |
.stSelectbox > div > div {
|
| 100 |
-
background-color: #
|
| 101 |
-
border-radius:
|
| 102 |
-
border: 2px solid #e1e8ff;
|
| 103 |
-
font-family: 'Inter', sans-serif;
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
.stSlider > div > div {
|
| 109 |
background-color: #f8f9ff;
|
| 110 |
border-radius: 15px;
|
|
@@ -112,6 +163,14 @@ st.markdown("""
|
|
| 112 |
border: 2px solid #e1e8ff;
|
| 113 |
}
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
/* Button styling */
|
| 116 |
.stButton > button {
|
| 117 |
background: linear-gradient(135deg, #6c5ce7, #fd79a8);
|
|
@@ -188,9 +247,10 @@ st.markdown("""
|
|
| 188 |
.footer {
|
| 189 |
text-align: center;
|
| 190 |
margin-top: 2rem;
|
| 191 |
-
color: rgba(255,255,255,0.
|
| 192 |
font-family: 'Inter', sans-serif;
|
| 193 |
font-size: 0.9rem;
|
|
|
|
| 194 |
}
|
| 195 |
|
| 196 |
/* Responsive design */
|
|
@@ -235,15 +295,22 @@ def load_model():
|
|
| 235 |
# Prediction function
|
| 236 |
def predict_solution(diameter, soil_type, high_water, model, le_soil, le_water, le_solution):
|
| 237 |
try:
|
|
|
|
|
|
|
| 238 |
# Encode inputs
|
| 239 |
soil_encoded = le_soil.transform([soil_type])[0]
|
| 240 |
water_encoded = le_water.transform([high_water])[0]
|
| 241 |
|
| 242 |
-
# Create feature
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
# Make prediction
|
| 246 |
-
prediction_encoded = model.predict(
|
| 247 |
prediction = le_solution.inverse_transform([prediction_encoded])[0]
|
| 248 |
|
| 249 |
return prediction
|
|
|
|
| 87 |
border: 1px solid rgba(255,255,255,0.2);
|
| 88 |
}
|
| 89 |
|
| 90 |
+
/* Input labels - Clean and simple */
|
| 91 |
.stSelectbox label, .stSlider label {
|
| 92 |
+
font-family: 'Inter', sans-serif !important;
|
| 93 |
+
font-weight: 600 !important;
|
| 94 |
+
color: #2c3e50 !important;
|
| 95 |
+
font-size: 1rem !important;
|
| 96 |
+
margin-bottom: 0.5rem !important;
|
| 97 |
+
display: block !important;
|
| 98 |
}
|
| 99 |
|
| 100 |
+
/* Selectbox styling - Force dark text on light background */
|
| 101 |
.stSelectbox > div > div {
|
| 102 |
+
background-color: #ffffff !important;
|
| 103 |
+
border-radius: 10px !important;
|
| 104 |
+
border: 2px solid #e1e8ff !important;
|
| 105 |
+
font-family: 'Inter', sans-serif !important;
|
| 106 |
+
color: #000000 !important;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/* Critical: Force dropdown text to be visible */
|
| 110 |
+
.stSelectbox [data-baseweb="select"] {
|
| 111 |
+
background-color: #ffffff !important;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.stSelectbox [data-baseweb="select"] > div {
|
| 115 |
+
background-color: #ffffff !important;
|
| 116 |
+
color: #000000 !important;
|
| 117 |
+
font-weight: 600 !important;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/* Target the actual button that shows selected value */
|
| 121 |
+
.stSelectbox [data-baseweb="select"] > div > div[role="button"] {
|
| 122 |
+
background-color: #ffffff !important;
|
| 123 |
+
color: #000000 !important;
|
| 124 |
+
font-weight: 600 !important;
|
| 125 |
+
border: 2px solid #e1e8ff !important;
|
| 126 |
+
border-radius: 10px !important;
|
| 127 |
+
padding: 0.75rem 1rem !important;
|
| 128 |
+
min-height: 50px !important;
|
| 129 |
}
|
| 130 |
|
| 131 |
+
/* Force text color in the button */
|
| 132 |
+
.stSelectbox [data-baseweb="select"] > div > div[role="button"] > div {
|
| 133 |
+
color: #000000 !important;
|
| 134 |
+
font-weight: 600 !important;
|
| 135 |
+
font-size: 1rem !important;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* Target dropdown options when opened */
|
| 139 |
+
.stSelectbox [data-baseweb="select"] [data-baseweb="menu"] {
|
| 140 |
+
background-color: #ffffff !important;
|
| 141 |
+
border: 2px solid #e1e8ff !important;
|
| 142 |
+
border-radius: 10px !important;
|
| 143 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.stSelectbox [data-baseweb="select"] [data-baseweb="menu"] > ul > li {
|
| 147 |
+
background-color: #ffffff !important;
|
| 148 |
+
color: #000000 !important;
|
| 149 |
+
font-weight: 600 !important;
|
| 150 |
+
padding: 0.75rem 1rem !important;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.stSelectbox [data-baseweb="select"] [data-baseweb="menu"] > ul > li:hover {
|
| 154 |
+
background-color: #f8f9ff !important;
|
| 155 |
+
color: #000000 !important;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
/* Slider styling */
|
| 159 |
.stSlider > div > div {
|
| 160 |
background-color: #f8f9ff;
|
| 161 |
border-radius: 15px;
|
|
|
|
| 163 |
border: 2px solid #e1e8ff;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
/* Input container heading */
|
| 167 |
+
.input-container h3 {
|
| 168 |
+
color: #2c3e50 !important;
|
| 169 |
+
font-weight: 700 !important;
|
| 170 |
+
font-family: 'Inter', sans-serif !important;
|
| 171 |
+
margin-bottom: 1.5rem !important;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
/* Button styling */
|
| 175 |
.stButton > button {
|
| 176 |
background: linear-gradient(135deg, #6c5ce7, #fd79a8);
|
|
|
|
| 247 |
.footer {
|
| 248 |
text-align: center;
|
| 249 |
margin-top: 2rem;
|
| 250 |
+
color: rgba(255,255,255,0.95);
|
| 251 |
font-family: 'Inter', sans-serif;
|
| 252 |
font-size: 0.9rem;
|
| 253 |
+
text-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
| 254 |
}
|
| 255 |
|
| 256 |
/* Responsive design */
|
|
|
|
| 295 |
# Prediction function
|
| 296 |
def predict_solution(diameter, soil_type, high_water, model, le_soil, le_water, le_solution):
|
| 297 |
try:
|
| 298 |
+
import pandas as pd
|
| 299 |
+
|
| 300 |
# Encode inputs
|
| 301 |
soil_encoded = le_soil.transform([soil_type])[0]
|
| 302 |
water_encoded = le_water.transform([high_water])[0]
|
| 303 |
|
| 304 |
+
# Create feature DataFrame with proper column names to match training
|
| 305 |
+
feature_data = {
|
| 306 |
+
'Diameter': [diameter],
|
| 307 |
+
'soil_encoded': [soil_encoded],
|
| 308 |
+
'water_encoded': [water_encoded]
|
| 309 |
+
}
|
| 310 |
+
features_df = pd.DataFrame(feature_data)
|
| 311 |
|
| 312 |
# Make prediction
|
| 313 |
+
prediction_encoded = model.predict(features_df)[0]
|
| 314 |
prediction = le_solution.inverse_transform([prediction_encoded])[0]
|
| 315 |
|
| 316 |
return prediction
|