This project provides a simple web application for sentiment analysis of IMDb movie reviews using a pre-trained TensorFlow model. The application is built with Streamlit, allowing users to input a movie review and receive a sentiment prediction (Positive or Negative).
- Input a movie review via a text area.
- Analyze the sentiment using a pre-trained TensorFlow model.
- Display the predicted sentiment (Positive or Negative).
- Python 3.8+
- Streamlit
- TensorFlow
- Clone the repository:
git clone <repository_url> cd <repository_directory>
- Install the required packages:
pip install -r requirements.txt
- Ensure the pre-trained model file (
path_to_your_model.h5) is available and update theload_modelfunction indl_movie.pywith the correct file path.
- Run the Streamlit app:
streamlit run dl_movie.py
- Open the provided URL in your browser (typically
http://localhost:8501). - Enter a movie review in the text area and click "Analyze Review" to see the sentiment prediction.
dl_movie.py: Main application script containing the Streamlit app and model logic.path_to_your_model.h5: Pre-trained TensorFlow model file (update path as needed).requirements.txt: List of required Python packages.
- The model file (
path_to_your_model.h5) must be a valid TensorFlow model trained for binary sentiment classification. - The
predict_sentimentfunction assumes a binary classification threshold of 0.5. - Ensure the model path in
load_modelis correctly set before running the app.