A modern web application that uses AI to predict the next words in a text. Built with React, TypeScript, and Vite.
- Smart Text Prediction: Get AI-powered suggestions for the next words in your text
- Interactive Interface: Click on predicted words to add them to your text
- Real-time Predictions: Get new predictions after each word selection
- Beautiful UI: Modern, responsive design with gradient backgrounds
- LLM Integration: Supports OpenAI GPT models (with fallback to mock predictions)
- Node.js (version 16 or higher)
- npm or yarn
-
Clone or download this project
-
Install dependencies:
npm install
-
(Optional) Set up OpenAI API key:
- Copy
env.exampleto.env - Add your OpenAI API key to the
.envfile:VITE_OPENAI_API_KEY=your_openai_api_key_here - If no API key is provided, the app will use intelligent mock predictions
- Copy
npm run devThe app will be available at http://localhost:3000
npm run build- Type your text: Enter some text in the text area
- Get predictions: Click "Predict Next Words" to see AI-suggested next words
- Select words: Click on any of the 5 predicted words to add it to your text
- Continue predicting: After selecting a word, click "Predict Next Words" again for more suggestions
- Clear and start over: Use the "Clear" button to reset and start fresh
- The app analyzes your input text and suggests the 5 most likely next words
- Each prediction shows a probability percentage
- Predictions are contextually relevant to your input
- Seamlessly add predicted words to your text
- Get new predictions after each word selection
- Build longer texts through iterative prediction
- Responsive design that works on desktop and mobile
- Beautiful gradient backgrounds and smooth animations
- Intuitive button layouts and clear visual feedback
- Frontend: React 18 with TypeScript
- Build Tool: Vite for fast development and building
- Styling: CSS with modern features (gradients, flexbox, grid)
- AI Integration: OpenAI GPT-3.5-turbo (with intelligent mock fallback)
- State Management: React hooks for local state
The app supports OpenAI's GPT models for real predictions. If no API key is provided, it uses intelligent mock predictions that are contextually relevant to your input.
The project uses:
- TypeScript for type safety
- Vite for fast development server
- ESLint for code quality (if configured)
- Modern CSS with flexbox and grid layouts
This project is open source and available under the MIT License.