Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available:
1.52.2
metadata
title: AI-Driven Daily Gross Margin (Revenue β COGS)
emoji: π
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: 1.37.1
app_file: app.py
pinned: false
AI-Driven Daily Gross Margin (Revenue β COGS) β Streamlit Demo
What it shows
- Synthetic SAP-like daily transactions
- Model: RandomForestRegressor predicts GM% and explains drivers with SHAP
- Daily analysis: KPIs, top drivers, segment hotspots
- What-if simulator: adjust discount/cost per segment using an estimated elasticity
- Recommendations: ranked actions with expected GM uplift
Run locally
python -m venv .venv && source .venv/bin/activate # on Windows: .venv\Scripts\activate
pip install -r requirements.txt
streamlit run app.py
Deploy to Hugging Face Spaces
- Create a new Space β SDK: Streamlit.
- Upload
app.py,requirements.txt, and thisREADME.md. - The Space will build automatically and launch the app.
Notes
- Data is synthetic but embeds realistic pricing, discounting, cost, and elasticity signals.
- SHAP is computed on demand with a sample size control for performance.
- Recommendations are illustrative; in production, add policy bounds, portfolio constraints, and cost/promo feasibility tables.