Spaces:
Sleeping
Sleeping
Suresh Beekhani
commited on
Update readme.md
Browse files
readme.md
CHANGED
@@ -1,83 +1,61 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: "1.
|
8 |
-
app_file:
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
# MySQL Python Chatbot with GPT-4 and Mistral AI
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
|
17 |
## Features
|
18 |
-
-
|
19 |
-
-
|
20 |
-
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
```bash
|
40 |
-
git clone [repository-link]
|
41 |
-
cd [repository-directory]
|
42 |
-
```
|
43 |
-
|
44 |
-
Install the required packages:
|
45 |
-
|
46 |
-
```bash
|
47 |
pip install -r requirements.txt
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
streamlit run app.py
|
61 |
-
|
62 |
-
|
63 |
-
## Contributing
|
64 |
-
As this repository accompanies the [YouTube video tutorial](https://youtu.be/YqqRkuizNN4), we are primarily focused on providing a comprehensive learning experience. Contributions for bug fixes or typos are welcome.
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
---
|
74 |
|
75 |
-
We hope this repository aids in your exploration of integrating AI with web technologies. For more informative tutorials, be sure to check out [Your YouTube Channel].
|
76 |
-
|
77 |
-
Happy Coding! ππ¨βπ»π€
|
78 |
-
|
79 |
-
---
|
80 |
-
|
81 |
-
*If you find this project helpful, please consider giving it a star!*
|
82 |
-
|
83 |
-
---
|
|
|
1 |
---
|
2 |
+
title: Chat with MySQL
|
3 |
+
emoji: π¬
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: blue
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: "1.0"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
---
|
|
|
11 |
|
12 |
+
# Chat with MySQL
|
13 |
|
14 |
+
This is a Streamlit application that allows users to interact with a MySQL database via natural language queries. The app uses LangChain, Groq, and Streamlit to generate SQL queries and respond with database results in natural language.
|
15 |
|
16 |
## Features
|
17 |
+
- Connect to your MySQL database and chat with it using natural language.
|
18 |
+
- Automatically generate SQL queries based on your questions.
|
19 |
+
- Receive responses both in SQL and human-readable formats.
|
20 |
+
|
21 |
+
## Libraries and Tools Used
|
22 |
+
- **dotenv**: Loads environment variables from a `.env` file.
|
23 |
+
- **LangChain**: Handles the prompt templates and chains for generating SQL queries and responses.
|
24 |
+
- **Groq**: Utilized as the model for chat-based interactions and SQL generation.
|
25 |
+
- **Streamlit**: Provides the interface for interacting with the database and handling the conversation.
|
26 |
+
- **SQLDatabase**: LangChain's utility to manage SQL database connections and queries.
|
27 |
+
|
28 |
+
## Setup Instructions
|
29 |
+
|
30 |
+
1. Clone the repository:
|
31 |
+
```bash
|
32 |
+
git clone https://github.com/your-repo/chat-with-mysql.git
|
33 |
+
cd chat-with-mysql
|
34 |
+
Install the required Python libraries:
|
35 |
+
|
36 |
+
bash
|
37 |
+
Copy code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
pip install -r requirements.txt
|
39 |
+
Create a .env file in the root directory of the project and add your database credentials:
|
40 |
+
|
41 |
+
bash
|
42 |
+
Copy code
|
43 |
+
DB_USER=root
|
44 |
+
DB_PASSWORD=admin
|
45 |
+
DB_HOST=localhost
|
46 |
+
DB_PORT=3306
|
47 |
+
DB_NAME=Chinook
|
48 |
+
Run the application:
|
49 |
+
|
50 |
+
bash
|
51 |
+
Copy code
|
52 |
streamlit run app.py
|
53 |
+
Open your browser and go to the Streamlit web app, typically at http://localhost:8501.
|
|
|
|
|
|
|
54 |
|
55 |
+
How It Works
|
56 |
+
The app connects to a MySQL database using credentials from environment variables.
|
57 |
+
It uses a LangChain model to process user queries, convert them into SQL statements, and return the results.
|
58 |
+
You can view the SQL query generated from your questions and the corresponding response.
|
59 |
+
Configuration
|
60 |
+
Check out the configuration reference at Hugging Face Spaces Config Reference.
|
|
|
|
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|