Skip to content

hrnrxb/BERTBiLSTM-Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฌ BERT + BiLSTM Sentiment Classifier: Unlocking Text Emotions

Dive into the world of sentiment analysis with this lightweight yet powerful classifier, designed for understanding the emotional tone of text. This project combines the cutting-edge contextual understanding of BERT with the sequential modeling prowess of Bidirectional LSTMs (BiLSTM), all wrapped in an interactive interface powered by Gradio.


โœจ Features: Why This Model Shines

This sentiment classifier is built for efficiency and clarity, offering key advantages:

  • Hybrid Powerhouse: Leverages BERT (specifically bert-base-uncased) as a robust contextual embedding extractor, feeding into a BiLSTM layer for capturing long-range dependencies and sequential patterns in text. This hybrid approach allows for nuanced sentiment detection.
  • Custom PyTorch Implementation: Built with a custom PyTorch model rather than relying on the Hugging Face Trainer, providing full control and transparency over the training and model architecture.
  • Real-time Interaction: Features a Gradio-powered web interface for instant, real-time sentiment predictions directly from your browser. Input your text and see the results immediately!
  • Clean & Deployable: The codebase is clean, well-structured, and ready for easy deployment on platforms like Hugging Face Spaces or for quick demonstrations on GitHub.

๐Ÿš€ Run Locally: Get Your Sentiment Classifier Up and Running

Follow these steps to set up and run the sentiment classifier on your local machine.

  1. Clone the Repository: Start by getting a copy of the project files to your local system.

    git clone [https://github.com/your-username/your-repo-name](https://github.com/your-username/your-repo-name) # Replace with your actual repo URL
    cd your-repo-name # Replace with your actual repo name
  2. Create and Activate a Python Virtual Environment: It's highly recommended to use a virtual environment to manage project dependencies. This isolates your project's libraries from others on your system, preventing conflicts.

    python3 -m venv env
    source env/bin/activate  # On macOS/Linux
    # On Windows: .\env\Scripts\activate
  3. Install Dependencies: Once your virtual environment is active, install all necessary Python libraries from the requirements.txt file.

    pip install -r requirements.txt
  4. Run the Gradio Application: Finally, launch the interactive Gradio interface.

    python app.py

    The application will start, and you'll typically find the web interface accessible in your browser at http://127.0.0.1:7860/.


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages