Code Monkey home page Code Monkey logo

text-to-sql's Introduction

text-to-sql

llama + SQL + PyGWalker + Flask

Table of Contents

About

A personally hosted text-to-sql application that can be used to interact with your databases using natural language queries. The UI has provisions to switch between available databases, search and select tables available in the selected database, modify the SQL query generated from the Llama model and search and visualize the output as needed using PyGWalker.

The application uses code llama 7B GGUF - 5 bit model and can run on CPU (time taken to query the output varies depending on the hardware though).
You can replace this model with other models more suited to your hardware.

Demo

Query Pages application screenshots

Visualization Page PyGWalker render

Installation

# Clone the repository
git  clone  https://github.com/raghujhts13/text-to-sql.git

# change directory to where files are present
cd text-to-sql

# install the required libraries using the requirements.txt
pip  install  -r  requirements.txt

# start the application
python app.py

change the user credentials in the .env file inside the config folder FLASK_KEY = random string ( this will not affect the application ) MODEL_PATH = path where you have the saved model (or) where you want to install the model

You can access the application at http://127.0.0.1:5000 (if this is the port where the application is running) If you are unable to do the above, check the command prompt to fetch the URL of the flask server.

NOTE

You can change the model by altering the variable llm_model inside the app.py file. the first argument is the model name and the second argument is version/ type(second argument is not mandatory, so you can leave it empty if you are unsure about the version) Example I have downloaded the model from TheBloke/CodeLlama-7B-Instruct-GGUF from Hugging Face. Inside this repository I have downloaded the codellama-7b-instruct.Q5_K_M.gguf model. Therefore, I have used the below arguments.

# loading the model using ctransformers
llm_model  =  llm('TheBloke/CodeLlama-7B-Instruct-GGUF','codellama-7b-instruct.Q5_K_M.gguf')

text-to-sql's People

Contributors

raghujhts13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

text-to-sql's Issues

Setup Instructions

Hi there,

Hope this issue finds you well :))

could you please add an instruction for how I should setup this code in my local machine.
I tried python 3.11 and 3.9 but resolving requirements.txt was not successful.

cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.