Devashish-Nagpal commited on
Commit
6854c73
·
1 Parent(s): 3df0bf8

Updated readme.md

Browse files
Files changed (1) hide show
  1. README.md +54 -0
README.md CHANGED
@@ -8,3 +8,57 @@ sdk_version: 5.15.0
8
  app_file: app/app.py
9
  pinned: false
10
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  app_file: app/app.py
9
  pinned: false
10
  ---
11
+
12
+ # SQL Chat Assistant
13
+
14
+ ## Overview
15
+
16
+ This project is a Flask-based chat assistant that converts natural language queries into SQL statements using state-of-the-art NLP models. The system leverages Hugging Face transformer models, sentence embedding techniques, and fine-tuning approaches to generate accurate SQL queries for an SQLite database.
17
+
18
+ The primary goal of this project is to enable users to interact with structured data using conversational language, making database queries accessible to non-technical users.
19
+
20
+ ## Approach
21
+
22
+ ### 1. Pretrained Transformer Models (Hugging Face)
23
+
24
+ Initially, multiple Hugging Face models were tested to generate SQL queries from natural language inputs. However, most of them produced inconsistent results due to their general training data.
25
+
26
+ ### 2. Sentence Transformers + Cosine Similarity + Parameter Extraction
27
+
28
+ To improve query generation, I experimented with an approach that captures the semantic meaning of user queries and maps them to predefined SQL templates using:
29
+
30
+ - **Sentence embeddings**: Extracting vector representations of queries.
31
+ - **Cosine similarity**: Matching user queries with predefined SQL structures.
32
+ - **Regular expression templates**: Extracting SQL parameters dynamically to refine query formation.
33
+
34
+ ### 3. Fine-Tuning T5-Small with ONNX Quantization
35
+
36
+ To enhance accuracy, I fine-tuned the t5-small model using a custom dataset based on the structure of my SQLite database.
37
+
38
+ ONNX quantization was applied to reduce the model size and improve deployment efficiency while staying within hosting constraints.
39
+
40
+ ## Installation Guide
41
+
42
+ ### 1. Clone the Repository
43
+
44
+ ```sh
45
+ git clone https://github.com/DevashishXO/SQLite-Chat-Assistant.git
46
+ cd SQLite-Chat-Assistant
47
+
48
+ ### 2. Install Dependencies
49
+
50
+ ```sh
51
+ pip install -r requirements.txt
52
+
53
+ ### 3. Set up the SQLite Database
54
+
55
+ ```sh
56
+ python data/initialize_db.py
57
+
58
+ ### 4. Run the Flask App
59
+
60
+ ```sh
61
+ $env:FLASK_APP="app.main:app"
62
+ flask run
63
+
64
+