| --- |
| title: Amazon Analytics Chatbot |
| emoji: π¦ |
| colorFrom: blue |
| colorTo: green |
| sdk: docker |
| app_port: 8501 |
| pinned: false |
| license: mit |
| short_description: RAG + SQL chatbot for Amazon seller analytics (demo data) |
| --- |
| |
| # π¦ Amazon Analytics Chatbot |
|
|
| A Streamlit chatbot (Docker-backed) that answers questions about Amazon seller |
| analytics using **SQL templates** for quantitative queries and **FAISS semantic |
| search (RAG)** for qualitative ones. |
|
|
| ## ποΈ Architecture |
|
|
| - **SQL Engine** β SQLite + SQLAlchemy, template-based query generation |
| - **RAG** β `sentence-transformers/all-MiniLM-L6-v2` embeddings + FAISS index |
| - **LLM** β Hugging Face Inference API (default: `Qwen/Qwen2.5-7B-Instruct`) |
| - **UI** β Streamlit with a custom dark theme, served via Docker |
|
|
| ## π Files |
|
|
| ``` |
| Dockerfile β Build & run instructions |
| requirements.txt β Python deps |
| src/ |
| βββ streamlit_app.py β Streamlit UI (entry point) |
| βββ rag_core.py β RAG + SQL engine |
| βββ company_data.db β SQLite database (demo data) |
| βββ rag.index β FAISS vector index |
| βββ rag_chunks.parquetβ Chunk metadata |
| ``` |
|
|
| ## π Secrets |
|
|
| In **Settings β Variables and secrets β New secret**, add: |
|
|
| - `HF_TOKEN` β your Hugging Face access token (read scope) |
|
|
| Optional: |
|
|
| - `HF_MODEL` β override default model, e.g. |
| `meta-llama/Llama-3.2-3B-Instruct` |
|
|
| ## π‘ Example Questions |
|
|
| - "Total revenue in 2023 Q1" |
| - "Monthly sessions trend last 30 days" |
| - "Top search terms by spend" |
| - "2024 H1 B2B revenue by state" |
|
|
| > The included database contains **demo / synthetic data** only. |
|
|
| ## π License |
|
|
| MIT |
|
|