A deep learning project utilizing a Recurrent Neural Network (RNN) to classify IMDB movie reviews as positive or negative, featuring an interactive Streamlit web application.
This project implements a simple RNN model to perform sentiment analysis on IMDB movie reviews. The model is trained to predict whether a given movie review expresses a positive or negative sentiment. An interactive user interface is provided through Streamlit, allowing users to input their own reviews and receive real-time sentiment predictions.
- TensorFlow/Keras: For building and training the RNN model.
- Pandas & NumPy: For data processing and manipulation.
- Streamlit: For creating an interactive web application.
- Jupyter Notebook: For interactive and flexible environment.
Try the live demo here: Live App
main.py
: Streamlit application script.simplernn.h5
: Pre-trained RNN model file.requirements.txt
: List of required Python packages.README.md
: Project documentation (this file).img1.png
&img2.png
: Sample images from the project.
-
Clone the Repository
git clone https://github.com/laavanjan/Simple_RNN_imdb.git cd Simple_RNN_imdb
-
Create and Activate a Virtual Environment
python3 -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Run the Streamlit App
streamlit run main.py
-
Interact with the App
- Open your browser and navigate to
http://localhost:8501
. - Enter a movie review in the text box provided.
- Click the "Classify" button to see the predicted sentiment and confidence score.
- Open your browser and navigate to
The RNN model was trained on the IMDB dataset, which contains 25,000 movie reviews labeled as positive or negative. The training process involved:
- Tokenizing and padding the text data.
- Building a Sequential model with an Embedding layer and a SimpleRNN layer.
- Compiling the model with the Adam optimizer and binary cross-entropy loss function.
- Training the model over multiple epochs with a batch size of 32.
The model achieves an accuracy of approximately 85% on the test dataset, demonstrating its effectiveness in classifying movie review sentiments.
Sample images from the project:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL License.