The AI Grammar Corrector is a web application that uses OpenAI's GPT model to correct grammar. It allows users to input text, submit it for correction, and view the corrected version provided by the AI.
- Text Input: Users can type or paste text into a text area.
- AI Correction: The app sends the text to OpenAI's API to receive grammatical corrections.
- Display Output: Corrected text is displayed in a read-only text area.
- Node.js: Runtime for server-side JavaScript.
- Express: Web framework for Node.js.
- EJS: Embedded JavaScript templating engine for rendering HTML views.
- Node-Fetch: Module for making HTTP requests.
- OpenAI API: Provides AI-driven text correction.
- Node.js and npm (Node Package Manager) installed on your machine.
- An OpenAI API key. Sign up for an API key here.
-
Clone the Repository:
git clone https://github.com/nicolefabian/AI-Grammar-Bot.git
-
Install Dependencies
npm install
-
Configure Environment Variables
Create a
.env
file in the root directory of the project with the following content:OPENAI_KEY=your_openai_api_key PORT=your_port_number
Replace your_openai_api_key
and your_port_number
with your actual OpenAI API key and desired port number.
- Start the application
node app.js
-
Open Your Browser:
Navigate to
http://localhost:5000
(or the port specified in your.env
file). -
Enter Text:
Type or paste the text you want to correct in the provided text area.
-
Submit for Correction:
Click the "Enhance with AI" button to submit the text for correction.
-
View Corrected Text:
The corrected text will be displayed in the output area below the input text area.