This project is a simple ChatGPT-like application that uses the OpenAI API to generate responses to user questions. It uses React for the frontend and Flask for the backend.
To run this project, you'll need:
- Node.js and npm (for the frontend)
- Python 3.6 or higher (for the backend)
- An OpenAI API key
You can sign up for an API key from OpenAI.
Start by cloning this repository to your local machine:
git clone https://github.com/your-username/simple-chatgpt.git
Navigate to the project directory:
cd simple-chatgpt
Navigate to the backend
folder:
cd backend
Create a Python virtual environment:
python3 -m venv venv
Activate the virtual environment:
-
On macOS/Linux:
source venv/bin/activate
-
On Windows:
venv\Scripts\activate
Install the required Python dependencies:
pip install -r requirements.txt
Edit the .env
file located in ./backend
folder and replace the value that appears right after the equals sign with your key:
OPENAI_API_KEY=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
Open a new terminal window and navigate to the frontend
folder:
cd frontend
Install the required Node.js dependencies:
npm install
From the backend
folder, start the Flask server:
# Python version should be >= 3.0
python app.py
The backend server will be running at http:/localhost:5000
.
From the frontend
folder, start the React development server:
npm start
Now you can visit http://localhost:3000
in your browser and start using the Simple ChatGPT app!
This project is licensed under the terms of the MIT license.