import streamlit as st from transformers import AutoModelForSequenceClassification, AutoTokenizer import torch # Load pre-trained emotion detection model model_name = "j-hartmann/emotion-english-distilroberta-base" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name) # Get the actual emotion labels from the model emotion_labels = model.config.id2label # Emotion styles (emoji + colors) emotion_styles = { "joy": {"emoji": "😃", "color": "#FFD700"}, # Gold "sadness": {"emoji": "😢", "color": "#3498DB"}, # Blue "anger": {"emoji": "😡", "color": "#8E44AD"}, # Red "fear": {"emoji": "😨", "color": "#E74C3C"}, # Purple "surprise": {"emoji": "😲", "color": "#F1C40F"}, # Yellow "disgust": {"emoji": "🤢", "color": "#2ECC71"}, # Green "neutral": {"emoji": "😐", "color": "#95A5A6"} # Gray } # Streamlit UI st.set_page_config(page_title="Emotion Detection", layout="centered") # 🎨 Change Background Color to Black st.markdown( """ """, unsafe_allow_html=True ) # 🎯 Add Image at the Top st.image("innomatics_logo.png", use_container_width=True, width=300) # Replace with your image filename # 🏷️ Title st.markdown("
Organizations aim to enhance customer experiences, mental health support, and marketing strategies by analyzing human emotions from text, speech, and facial expressions. However, accurately detecting emotions remains a challenge due to their subjective nature.
The project aims to create a Machine Learning-based Emotion Detection System that can accurately identify human emotions. This will aid businesses in analyzing customer sentiment, enhancing user engagement, and improving real-time decision-making.
The model should provide high accuracy in detecting emotions, but complex models may be difficult for business users to interpret. Real-time processing and latency are crucial for applications like chatbots and customer support. Data quality and availability are essential, with a balanced dataset and handling of missing or noisy data. The model should be scalable, ethical, and privacy-conscious, integrating seamlessly with existing business tools. Cost constraints include compute costs for training and cloud deployment. The model should be robust and context-aware, working across multiple platforms.
""", unsafe_allow_html=True ) st.markdown("