Spaces:
Running on Zero
Running on Zero
|
Download README.md from sagar312/Text-to-SQL: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/sagar312/Text-to-SQL/resolve/main/README.md
- Command line
-
hf download hf://spaces/sagar312/Text-to-SQL/README.md
-
curl -L -o README.md https://huggingface.co/spaces/sagar312/Text-to-SQL/resolve/main/README.md
1.4 kB
| title: Text to SQL Demo | |
| emoji: ποΈ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: 5.10.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| # Text-to-SQL Demo | |
| Ask a plain-English question about a sample e-commerce database (customers, | |
| products, orders, order_items) and get back real, generated SQL plus the | |
| actual query results β retrieval, generation, AST validation, safe | |
| execution, and self-healing retries, all live. | |
| This demo runs a fine-tuned Qwen2.5-3B model for SQL generation, paired | |
| with a full retrieval-and-validation pipeline: hybrid schema retrieval | |
| (dense + BM25) narrows down the relevant tables, an AST-level validator | |
| enforces read-only, schema-checked queries before anything executes, and a | |
| self-healing loop retries automatically if a query fails, feeding the | |
| database's own error back to the model. Nothing but a validated `SELECT` | |
| ever reaches the database, regardless of what the model generates. | |
| ## Required Space secrets | |
| Set these under Settings β Repository secrets before running: | |
| | Secret | Example | | |
| |---|---| | |
| | `DB_HOST` | `db.yourproject.supabase.co` | | |
| | `DB_PORT` | `5432` | | |
| | `DB_NAME` | `postgres` | | |
| | `DB_USER` | `postgres` | | |
| | `DB_PASSWORD` | *(your database password)* | | |
| Point these at a **read-only** role on a database you're comfortable | |
| exposing publicly β this demo is configured for a small sample dataset, not | |
| production data. | |