Spaces:
Runtime error
Runtime error
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,13 +1,54 @@
|
|
| 1 |
-
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license:
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DataBot ERP Assistant
|
| 3 |
+
emoji: π€
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "4.44.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# DataBot β ERP Database Assistant
|
| 14 |
+
|
| 15 |
+
DataBot lets you ask **natural-language questions** about your ERP database.
|
| 16 |
+
It uses GPT-4o to translate your question into SQL, executes it safely on your
|
| 17 |
+
MySQL database, and returns a plain-English summary.
|
| 18 |
+
|
| 19 |
+
## Features
|
| 20 |
+
|
| 21 |
+
- Natural-language β SQL β plain-English answers
|
| 22 |
+
- Whitelist-based table access control (`data_access_config.json`)
|
| 23 |
+
- Blocks all write operations (INSERT / UPDATE / DELETE / DROP β¦)
|
| 24 |
+
- Masks sensitive columns (passwords, IBAN, salary, PII)
|
| 25 |
+
- Schema cached at startup for fast responses
|
| 26 |
+
|
| 27 |
+
## Setup (Hugging Face Spaces)
|
| 28 |
+
|
| 29 |
+
Set the following **Secrets** in your Space settings
|
| 30 |
+
(*Settings β Variables and secrets β New secret*):
|
| 31 |
+
|
| 32 |
+
| Secret name | Description |
|
| 33 |
+
|----------------|---------------------------------------|
|
| 34 |
+
| `DB_USER` | MySQL username |
|
| 35 |
+
| `DB_PASSWORD` | MySQL password |
|
| 36 |
+
| `DB_HOST` | MySQL host IP / domain |
|
| 37 |
+
| `DB_NAME` | Database name (default: `dev_poly`) |
|
| 38 |
+
| `OPENAI_API_KEY` | Your OpenAI API key |
|
| 39 |
+
| `LLM_MODEL` | Model to use (default: `gpt-4o`) |
|
| 40 |
+
|
| 41 |
+
## Local Development
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
# 1. Clone the repo and create .env
|
| 45 |
+
cp .env.example .env # fill in your credentials
|
| 46 |
+
|
| 47 |
+
# 2. Install dependencies
|
| 48 |
+
pip install -r requirements.txt
|
| 49 |
+
|
| 50 |
+
# 3. Run locally
|
| 51 |
+
python app.py
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
Then open http://localhost:7860 in your browser.
|