This project allows users to interact with GPT-3 to generate text responses, perform sentiment analysis on these responses, and generate visual sentiment reports. It uses a MySQL database to store user interactions and a pie chart for visualizing sentiment results.
- Python 3.9 or above
- MySQL database
- Hugging Face API Key
Clone the repository to your local machine:
git clone <repository-url>
cd <repository-directory>Install the required Python packages:
pip install -r requirements.txtCreate the MySQL database and the necessary table:
CREATE DATABASE gpt3_project;
USE gpt3_project;
CREATE TABLE interactions (
id INT AUTO_INCREMENT PRIMARY KEY,
user_input TEXT NOT NULL,
gpt_response TEXT NOT NULL,
sentiment VARCHAR(50) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);Add your Hugging Face API Key to the gpt3_integration.py file or set it as an environment variable. You may also want to create a .env file to store your MySQL password and other configuration settings.
To run the application locally:
python app.pyTo deploy the application using Docker:
-
Build the Docker image:
docker build -t gpt3_sentiment_project . -
Run the Docker container (make sure your MySQL container is running):
docker run -it --name gpt3_sentiment_app --link mysql-container2:mysql -p 5000:5000 gpt3_sentiment_project
- Text interaction with GPT-3
- Sentiment analysis (Positive, Negative, Neutral)
- MySQL database integration to store interactions
- Pie chart visualization of sentiment analysis results
- User-friendly command-line interface
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for the GPT-3 model
- Hugging Face for the API integration
- MySQL for the database
- Matplotlib for data visualization