import streamlit as st import random import time from streamlit.components.v1 import html # Set page config with light purple theme st.set_page_config( page_title="Emotion Mirror Chatbot", page_icon="š", layout="centered", initial_sidebar_state="collapsed" ) # Custom CSS for light purple theme st.markdown(""" """, unsafe_allow_html=True) # Emotion databases POSITIVE_WORDS = {"happy", "awesome", "great", "joy", "excited", "good", "wonderful", "fantastic", "amazing"} NEGATIVE_WORDS = {"sad", "depressed", "angry", "cry", "lonely", "bad", "terrible", "awful", "miserable"} HELP_RESPONSES = [ "Would you like to talk about it? š¬", "I'm here to listen š", "Want some uplifting quotes? š", "Would a virtual hug help? š¤", "Let's focus on something positive š" ] # ASCII Art Library FACES = { "happy": r""" āāāāāāāāāā š AWESOME! āāāāāāāāāā """, "sad": r""" āāāāāāāāāā š¢ SAD DAY? āāāāāāāāāā """, "neutral": r""" āāāāāāāāāā š HELLO āāāāāāāāāā """, "love": r""" āāāāāāāāāā š LOVELY! āāāāāāāāāā """ } # Confetti effect using JavaScript def confetti_effect(): confetti_js = """ """ html(confetti_js) # Emotion detection function def detect_emotion(text): text = text.lower() if any(word in text for word in POSITIVE_WORDS): return "happy" elif any(word in text for word in NEGATIVE_WORDS): return "sad" elif "love" in text or "heart" in text: return "love" return "neutral" # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] st.session_state.current_emotion = "neutral" # Title and description st.title("⨠Emotion Mirror Chatbot") st.markdown("I'm a reactive AI agent that mirrors your emotions! Try words like *happy*, *sad*, or *awesome*") # Display current face with st.container(): st.markdown(f"