This repository contains a Streamlit application for predicting the next word in a given text input using an LSTM model. The application leverages TensorFlow and a pre-trained LSTM model to generate word predictions.
- User Input: Enter a partial sentence or phrase to get a prediction for the next word.
- Real-time Prediction: The application provides real-time predictions based on the input text.
- Streamlit Interface: Easy-to-use web interface built with Streamlit.
Before running the application, ensure you have the following installed:
- Python 3.7 or later
- TensorFlow
- Streamlit
- Numpy
- Pickle
-
Clone the repository:
git clone https://github.com/alihassanml/next-word-prediction-using-lstm.git cd next-word-prediction-using-lstm
-
Install the required packages:
pip install -r requirements.txt
-
Ensure the
lstm_model.h5
andtokenizer.pickle
files are in the root directory of the project.
To run the Streamlit application, use the following command:
streamlit run app.py
This will start the Streamlit server, and you can interact with the application through your web browser.
- Open the application in your web browser.
- Enter a partial sentence or phrase in the input text box.
- Click the "Predict Next Word" button to get the predicted next word.
- The predicted next word will be displayed below the input box.
app.py
: The main Streamlit application file.lstm_model.h5
: The pre-trained LSTM model file.tokenizer.pickle
: The tokenizer used to preprocess the text data.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions or suggestions, feel free to contact me at alihassanml