Spaces:
Sleeping
Sleeping
Commit
·
e0fd3d2
1
Parent(s):
9e9b5c6
feat: updated website
Browse files
app.py
CHANGED
@@ -273,6 +273,7 @@ elif page == "Customer Analysis":
|
|
273 |
# Load the Corresponding Model
|
274 |
model_path = f'models/modelo_cluster_{cluster}.txt'
|
275 |
gbm = lgb.Booster(model_file=model_path)
|
|
|
276 |
|
277 |
with st.spinner("Getting the data ready..."):
|
278 |
# Load predict data for that cluster
|
@@ -280,12 +281,14 @@ elif page == "Customer Analysis":
|
|
280 |
|
281 |
# Convert cliente_id to string
|
282 |
predict_data['cliente_id'] = predict_data['cliente_id'].astype(str)
|
|
|
283 |
|
284 |
with st.spinner("Filtering data..."):
|
285 |
|
286 |
# Filter for the specific customer
|
287 |
customer_code_str = str(customer_code)
|
288 |
customer_data = predict_data[predict_data['cliente_id'] == customer_code_str]
|
|
|
289 |
|
290 |
with st.spinner("Generating sales predictions..."):
|
291 |
|
@@ -331,7 +334,7 @@ elif page == "Customer Analysis":
|
|
331 |
rmse = np.sqrt(mean_squared_error(valid_results['ventas_reales'], valid_results['ventas_predichas']))
|
332 |
|
333 |
st.write(f"Actual total sales for Customer {customer_code}: {valid_results['ventas_reales'].sum():.2f}")
|
334 |
-
st.write(f"MAE: {mae:.2f}")
|
335 |
st.write(f"MAPE: {mape:.2f}%")
|
336 |
st.write(f"RMSE: {rmse:.2f}")
|
337 |
|
|
|
273 |
# Load the Corresponding Model
|
274 |
model_path = f'models/modelo_cluster_{cluster}.txt'
|
275 |
gbm = lgb.Booster(model_file=model_path)
|
276 |
+
time.sleep(1)
|
277 |
|
278 |
with st.spinner("Getting the data ready..."):
|
279 |
# Load predict data for that cluster
|
|
|
281 |
|
282 |
# Convert cliente_id to string
|
283 |
predict_data['cliente_id'] = predict_data['cliente_id'].astype(str)
|
284 |
+
time.sleep(1)
|
285 |
|
286 |
with st.spinner("Filtering data..."):
|
287 |
|
288 |
# Filter for the specific customer
|
289 |
customer_code_str = str(customer_code)
|
290 |
customer_data = predict_data[predict_data['cliente_id'] == customer_code_str]
|
291 |
+
time.sleep(1)
|
292 |
|
293 |
with st.spinner("Generating sales predictions..."):
|
294 |
|
|
|
334 |
rmse = np.sqrt(mean_squared_error(valid_results['ventas_reales'], valid_results['ventas_predichas']))
|
335 |
|
336 |
st.write(f"Actual total sales for Customer {customer_code}: {valid_results['ventas_reales'].sum():.2f}")
|
337 |
+
st.write(f"MAE: {mae:.2f}€")
|
338 |
st.write(f"MAPE: {mape:.2f}%")
|
339 |
st.write(f"RMSE: {rmse:.2f}")
|
340 |
|