--- title: Emotion Classifier emoji: 🎭 colorFrom: indigo colorTo: blue sdk: streamlit sdk_version: 1.51.0 app_file: app.py pinned: false --- # 🎭 Emotion Classifier — RoBERTa Based A deep-learning model that classifies text into **five emotion categories**: **anger, fear, joy, sadness, surprise**. Built with **PyTorch, RoBERTa transformer, Streamlit UI** and deployed on **Hugging Face Spaces**. --- ## 🧠 Model Details | Component | Description | |-----------|-------------| | Base model | `roberta-base` | | Task | Single-label Emotion Classification | | Input | Raw text | | Output | Softmax probability distribution (5 emotions) | | Framework | PyTorch + Transformers | ### Load Model from Hugging Face ```python from huggingface_hub import hf_hub_download import torch from BertEmotionClassifier import BertEmotionClassifier model_path = hf_hub_download(repo_id="aadhi3/RoBert_Model", filename="model.pth") from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("roberta-base") model = BertEmotionClassifier(model_name="roberta-base", num_labels=5) state_dict = torch.load(model_path, map_location="cpu") model.load_state_dict(state_dict) model.eval() ```