olist-text2sql / README.md
mhdakmal80's picture
Upload 6 files
d60cb1f verified
---
title: Olist Text-to-SQL Agent
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app_gradio.py
pinned: false
license: mit
---
# πŸ€– Olist Text-to-SQL Agent
Convert natural language questions into SQL queries using a **fine-tuned Mistral-7B model**.
## 🎯 Features
- **Fine-Tuned Model**: Mistral-7B-Instruct-v0.2 fine-tuned with QLoRA on Olist e-commerce dataset
- **Natural Language to SQL**: Ask questions in plain English, get executable SQL queries
- **Real Database**: Query against actual Olist e-commerce data (100K+ orders)
- **Interactive UI**: Built with Gradio for easy interaction
## πŸš€ How to Use
1. Type your question in natural language
2. Click "Generate SQL & Execute"
3. View the generated SQL query and results
## πŸ’‘ Example Questions
- "How many orders are there?"
- "What are the top 5 best-selling products?"
- "Show total revenue by customer state"
- "Which sellers have the highest ratings?"
- "List all orders from SΓ£o Paulo"
## πŸ› οΈ Tech Stack
- **Model**: Mistral-7B-Instruct-v0.2 (fine-tuned with QLoRA)
- **Frontend**: Gradio
- **Database**: SQLite (Olist e-commerce dataset)
- **ML Libraries**: PyTorch, Transformers, PEFT, BitsAndBytes
## πŸ“Š Model Details
- **Base Model**: mistralai/Mistral-7B-Instruct-v0.2
- **Fine-Tuned Model**: [mhdakmal80/Olist-SQL-Agent-Final](https://huggingface.co/mhdakmal80/Olist-SQL-Agent-Final)
- **Training Method**: QLoRA (4-bit quantization)
- **Training Data**: 1000+ synthetic question-SQL pairs
- **Accuracy**: 90% on test set
## πŸŽ“ About
This project demonstrates:
- Fine-tuning large language models (7B parameters)
- Parameter-efficient fine-tuning with QLoRA
- Production deployment of ML models
- Full-stack application development
Built by [mhdakmal80](https://huggingface.co/mhdakmal80)