Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions submissions/Raghavan_Madabushi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Mood Checker 🎭

## What it does
A simple AI-powered tool that analyzes your text and tells you if you're feeling happy, sad, or neutral! It uses a pre-trained HuggingFace model to understand the emotional tone of your messages.

## How to run it
1. Install the required packages:
```bash
pip install transformers torch
```

2. Run the mood checker:
```bash
python mood_checker.py
```

3. Type in any message when prompted, and it will tell you the mood!

## Example
- Input: "I'm so excited about today!"
- Output: "😊 This message sounds HAPPY!"

- Input: "I'm feeling down today"
- Output: "😔 This message sounds SAD!"

## Why this project?
This project demonstrates how easy it is to use AI models for real-world applications. In just a few lines of code, we can analyze emotions in text - something that could be useful for mental health apps, customer service, or social media analysis!
65 changes: 65 additions & 0 deletions submissions/Raghavan_Madabushi/mood_checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""
Mood Checker - A simple AI tool to analyze emotional tone in text
Uses HuggingFace transformers for sentiment analysis
"""

from transformers import pipeline
import time

def main():
print("🎭 Welcome to Mood Checker! 🎭")
print("I can tell you if your message sounds happy, sad, or neutral!")
print("=" * 50)

# Load the sentiment analysis model (this might take a moment on first run)
print("Loading AI model... Please wait...")
sentiment_analyzer = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
print("✅ Model loaded successfully!")
print()

while True:
# Get user input
user_message = input("💬 Type your message (or 'quit' to exit): ").strip()

if user_message.lower() in ['quit', 'exit', 'q']:
print("👋 Thanks for using Mood Checker! Goodbye!")
break

if not user_message:
print("❌ Please type something!")
continue

# Analyze the sentiment
print("🤔 Analyzing your message...")
result = sentiment_analyzer(user_message)[0]

# Convert sentiment to mood
sentiment = result['label']
confidence = result['score']

if sentiment == 'POSITIVE':
mood = "HAPPY"
emoji = "😊"
elif sentiment == 'NEGATIVE':
mood = "SAD"
emoji = "😔"
else:
mood = "NEUTRAL"
emoji = "😐"

# Display results
print(f"{emoji} This message sounds {mood}!")
print(f" Confidence: {confidence:.1%}")
print("-" * 50)
print()

if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n👋 Goodbye!")
except Exception as e:
print(f"❌ Oops! Something went wrong: {e}")
print("Make sure you have the required packages installed:")
print("pip install transformers torch")
2 changes: 2 additions & 0 deletions submissions/Raghavan_Madabushi/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
transformers>=4.20.0
torch>=1.9.0