import gradio as gr # Dictionary of moods and emojis mood_emojis = { "happy": "😊", "sad": "😢", "angry": "😠", "excited": "🤩", "nervous": "😬", "tired": "😴", "surprised": "😲", "love": "❤️", "bored": "😐" } # Function to detect mood keywords and return emojis def mood_to_emoji(text): text = text.lower() found = [emoji for mood, emoji in mood_emojis.items() if mood in text] return " ".join(found) if found else "🤔 Can't tell how you're feeling!" # Gradio interface demo = gr.Interface( fn=mood_to_emoji, inputs=gr.Textbox(lines=2, placeholder="How are you feeling?"), outputs="text", title="🧠 Mood to Emoji Translator", description="Type a sentence describing your mood and get the emoji version!" ) demo.launch(share=True)