Skip to content
Merged
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
49 changes: 49 additions & 0 deletions Domains/AI-ML/MiniProjects/Emotion_classifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
**Contributor:** Ansh-1019

# 🎭 Real-Time Emotion Detection using DeepFace and OpenCV

This project detects human emotions in real-time using a webcam feed.
It utilizes the **DeepFace** library for emotion analysis and **OpenCV** for face detection and visualization.

---

## 🚀 Features

- Detects emotions such as **happy**, **sad**, **angry**, **surprise**, **neutral**, and more.
- Works in **real-time** using your webcam.
- Displays bounding boxes and emotion labels on detected faces.
- Gracefully handles frames without detectable faces.

---

## 🧠 Technologies Used

- **Python 3.8+**
- **OpenCV** – for capturing webcam feed and drawing on frames.
- **DeepFace** – for facial emotion analysis.
- **Haar Cascade Classifier** – for basic face detection.

---

## 📦 Installation

### 1️⃣ Clone or Download the Repository
```bash
git clone https://github.com/yourusername/emotion-detection.git
cd emotion-detection
```

---

## ▶️ How to Run

1. Save the provided code as **`emotion.py`** in your project folder.
2. Open **Command Prompt** or **Terminal** in that folder.
3. Run the script:

```bash
python emotion.py
```
4. Your webcam will open automatically.
5. A bounding box with your detected emotion will appear on screen.
6. Press **`q`** to quit the program.
45 changes: 45 additions & 0 deletions Domains/AI-ML/MiniProjects/Emotion_classifier/emotion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import cv2
from deepface import DeepFace


cap = cv2.VideoCapture(0)

while True:
ret, frame = cap.read()
if not ret:
break

try:

result = DeepFace.analyze(frame, actions=['emotion'], enforce_detection=False)


if isinstance(result, list):
emotion = result[0]['dominant_emotion']
else:
emotion = result['dominant_emotion']


face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
faces = face_cascade.detectMultiScale(frame, 1.3, 5)

for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
cv2.putText(frame, emotion, (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)

except Exception as e:

print("No face detected or error:", e)

cv2.putText(frame, "No face detected", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)


cv2.imshow('Emotion Detection', frame)


if cv2.waitKey(1) & 0xFF == ord('q'):
break


cap.release()
cv2.destroyAllWindows()
39 changes: 39 additions & 0 deletions Domains/AI-ML/MiniProjects/Voice_Assistant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
**Contributor:** Ansh-1019

# 🧠 Voice Assistant – Friday

A beginner-friendly Python voice assistant that listens, understands, and responds to your voice commands. This project was built to explore speech recognition, text-to-speech, and smart command execution in Python.

## 🚀 Features

- 🎤 **Voice Input** — Recognizes your voice using the microphone
- 🕓 **Tells the Time and Date** — Fetches current time and date on command
- 🎵 **Plays Songs** — Plays songs on YouTube using `pywhatkit`
- 😂 **Tells Jokes** — Lightens the mood with a random joke
- 📖 **Wikipedia Summaries** — Provides brief summaries from Wikipedia
- 🌐 **Google Search** — Searches the web for any topic
- 🧠 **Wake Word Detection** — Activates when you say **"Friday"**

## 🛠️ Tech Stack

- Python 3.13
- `speech_recognition` – Speech-to-text
- `pyttsx3` – Text-to-speech
- `pywhatkit` – YouTube/Google automation
- `wikipedia` – Search summaries
- `pyjokes` – Random jokes for fun

## 🗂️ Project Structure
* `friday.py`: The main entry point for running the voice assistant.
* `stt.py`: Contains modules and functions related to Speech-to-Text conversion.
* `tts.py`: Contains modules and functions related to Text-to-Speech conversion.
* `combine.py`: (Optional) This file is for experimental code merging features.
* `README.md`: This file, providing an overview and instructions for the project.
---

## 🚀 Getting Started

To run the assistant:

```bash
python friday.py
85 changes: 85 additions & 0 deletions Domains/AI-ML/MiniProjects/Voice_Assistant/friday.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import speech_recognition as sr
import pyttsx3
import datetime
import pywhatkit
import pyjokes
import wikipedia

def taking_command():
r = sr.Recognizer()

with sr.Microphone() as source:
print("Calibrating background noise...")
r.adjust_for_ambient_noise(source,duration=0.3)
print("Listening...")
audio = r.listen(source)
try:
text= r.recognize_google(audio)
print(text)
return(text)
except sr.RequestError:
print("check your internet")
responding("check your internet")
except sr.UnknownValueError:
print("cannot understand")
responding("cannot understand")

def responding(text):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[2].id)
engine.say(text)
engine.runAndWait()

def function():
audio=taking_command()

if audio is None:
return

audio=audio.lower()

if 'time' in audio:
time= datetime.datetime.now().strftime('%I:%M %p')
print("current time is "+time)
responding("current time is "+time)

elif 'play' in audio:
song= audio.replace('play','').strip()
responding("playing"+song)
pywhatkit.playonyt(song)

elif 'joke' in audio:
joke=pyjokes.get_joke()
print(joke)
responding(joke)

elif 'tell me' in audio:
inf= audio.replace('tell me','')
info= wikipedia.summary(inf ,2)
print(info)
responding(info)

elif 'date' in audio:
date= datetime.datetime.today().strftime('%d %B %Y')
print("today's date is "+date)
responding("today's date is "+date)

elif 'google' in audio:
data= audio.replace('google','').strip()
responding("googling"+data)
pywhatkit.search(data)

def wake_word():
while True:
text = taking_command()
if text and 'friday' in text.lower():
responding("yes captain, what can i do for you")
return

if __name__=="__main__":
responding("friday activated")
while True:
wake_word()
function()

Loading