This project is a Text-to-SQL application built using Streamlit that allows users to interact with their database files through natural language queries. By leveraging the Gemini API, the app translates user prompts into SQL queries and provides both the results and the corresponding SQL code.
- Upload Database File: Users can upload their database files in SQLite format.
- Natural Language Queries: Users can input prompts in plain English to specify the data they want to fetch from the database.
- SQL Query Generation: The app generates the SQL query corresponding to the user's prompt.
- Result Display: The app displays the results fetched from the database based on the generated SQL query.
- Python 3.8 or higher
- Streamlit
- Gemini API access
- Clone the repository:
git clone https://github.com/yourusername/texttosql-streamlit-app.git
- Navigate to the project directory:
cd texttosql-streamlit-app
- Install the required Python packages:
pip install -r requirements.txt
- Run the Streamlit app:
streamlit run app2.py
- Upload your SQLite database file when prompted.
- Enter a natural language query in the text box.
- The app will display the corresponding SQL query and the results fetched from the database.
app2.py
: Contains the core functionality of the application, including handling user inputs, interacting with the Gemini API, generating SQL queries, and displaying results.requirements.txt
: Lists the Python packages required to run the application. This includes:streamlit
requests
pandas
sqlite3
(if not built-in)- Any other dependencies necessary for the Gemini API integration
README.md
: This file, providing an overview and instructions for the project.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.