import streamlit as st from transformers import pipeline import pandas as pd # Page setup st.set_page_config(page_title="🎭 Emotion Guessing Game", layout="centered") # CSS for emoji bounce st.markdown(""" """, unsafe_allow_html=True) # Emoji for each emotion emoji_dict = { "joy": "😄", "sadness": "😢", "anger": "😠", "fear": "😱", "love": "❤️", "surprise": "😲" } # Online sound for each emotion sound_urls = { "joy": "https://www.soundjay.com/human/sounds/applause-8.mp3", "sadness": "https://www.soundjay.com/human/sounds/sigh-01.mp3", "anger": "https://www.soundjay.com/human/sounds/angry-shout-1.mp3", "fear": "https://www.soundjay.com/human/sounds/scream-02.mp3", "love": "https://www.soundjay.com/button/beep-07.mp3", "surprise": "https://www.soundjay.com/button/button-2.mp3" } # Load emotion detection model @st.cache_resource def load_model(): return pipeline("text-classification", model="bhadresh-savani/distilbert-base-uncased-emotion") classifier = load_model() # Title st.title("🎭 Emotion Guessing Game") st.markdown("Type a sentence and let AI guess your emotion!") # Input text = st.text_input("💬 How are you feeling today?") if text: result = classifier(text)[0] emotion = result["label"] confidence = round(result["score"] * 100, 2) emoji = emoji_dict.get(emotion, "🤔") # Show animated emoji st.markdown(f"