Spaces:
Sleeping
Sleeping
| 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. | |