Spaces:
Sleeping
Sleeping
File size: 1,272 Bytes
bd8d56b 4d06747 3db891b 4d06747 3db891b 4d06747 3db891b 4d06747 98d76ab 4d06747 98d76ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
---
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
```bash
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
1. Create a new Space β **SDK: Streamlit**.
2. Upload `app.py`, `requirements.txt`, and this `README.md`.
3. 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.
|