MOCKMATE / README.md
sriyanshcodes-dev
Initial clean commit for Hugging Face Spaces
fd13a7c
|
Raw History Blame Contribute Delete
10.3 kB

A newer version of the Gradio SDK is available: 6.30.0

Upgrade
metadata
title: MockMate AI - AI Interview Coach
emoji: 🎀
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.40.0
app_file: app.py
pinned: false
license: mit
short_description: End-to-end AI-powered interview assessment platform.

🎀 AI Interview Analyzer

An end-to-end AI-powered interview assessment platform that evaluates a candidate's communication, confidence, facial expressions, eye contact, posture, gestures, and overall body language using Computer Vision and Machine Learning.


πŸ“– Overview

Traditional mock interviews provide little objective feedback beyond the interviewer's opinion. This project aims to automate interview analysis using Computer Vision, Human Pose Estimation, Facial Landmark Detection, and AI-based scoring.

The system records (or uploads) an interview video and analyzes every aspect of the candidate's visual behavior.

Instead of simply saying

"Maintain eye contact."

the system provides measurable metrics like

Eye Contact        : 81%
Face Visibility    : 98%
Head Stability     : 90%
Posture Score      : 86%
Gesture Score      : 79%
Overall Score      : 84/100

and personalized coaching recommendations.


🎯 Project Goals

The objective is to create an AI assistant capable of evaluating a candidate's non-verbal communication during interviews.

The project focuses on

  • Face Visibility
  • Eye Contact
  • Head Pose
  • Facial Expressions
  • Body Posture
  • Hand Gestures
  • Body Stability
  • Video Quality
  • Personalized Feedback

The final goal is to generate an AI Interview Report.


πŸ— High Level Architecture


                User
                  β”‚
                  β–Ό
          Video Recording
                  β”‚
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                       β”‚
      β–Ό                       β–Ό
 Live Webcam            Uploaded Video
      β”‚                       β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
           Frame Source
                  β”‚
                  β–Ό
         Video Processing
                  β”‚
                  β–Ό
       Computer Vision Pipeline
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Face Detection                   β”‚
β”‚ Face Mesh                        β”‚
β”‚ Pose Estimation                  β”‚
β”‚ Hand Tracking                    β”‚
β”‚ Video Quality                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
        Behavioral Analysis
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Eye Contact                      β”‚
β”‚ Facial Emotion                   β”‚
β”‚ Head Pose                        β”‚
β”‚ Body Stability                   β”‚
β”‚ Hand Gestures                    β”‚
β”‚ Posture                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
          Scoring Engine
                  β”‚
                  β–Ό
         Report Generation
                  β”‚
                  β–Ό
           Interactive Dashboard

---

# πŸ“‚ Project Structure
AI-Interview/

β”œβ”€β”€ backend/
β”‚
β”œβ”€β”€ frontend/
β”‚
β”œβ”€β”€ uploads/
β”‚
β”œβ”€β”€ reports/
β”‚
β”œβ”€β”€ temp/
β”‚
β”œβ”€β”€ README.md
β”‚
└── .gitignore

Backend Structure


backend/

β”‚ β”œβ”€β”€ api/ β”‚ β”œβ”€β”€ upload.py β”‚ β”œβ”€β”€ analyze.py β”‚ β”œβ”€β”€ report.py β”‚ β”œβ”€β”€ services/ β”‚ β”‚ β”œβ”€β”€ video/ β”‚ β”‚ extractor.py β”‚ β”‚ β”‚ β”œβ”€β”€ vision/ β”‚ β”‚ β”‚ β”‚ detector.py β”‚ β”‚ landmarks.py β”‚ β”‚ β”‚ β”‚ face/ β”‚ β”‚ visibility.py β”‚ β”‚ eye_contact.py β”‚ β”‚ expression.py β”‚ β”‚ head_pose.py β”‚ β”‚ β”‚ β”‚ body/ β”‚ β”‚ posture.py β”‚ β”‚ stability.py β”‚ β”‚ β”‚ β”‚ hands/ β”‚ β”‚ gestures.py β”‚ β”‚ β”‚ β”‚ quality/ β”‚ β”‚ blur.py β”‚ β”‚ lighting.py β”‚ β”‚ camera_angle.py β”‚ β”‚ β”œβ”€β”€ scoring/ β”‚ β”‚ scorer.py β”‚ β”‚ β”‚ └── reporting/ β”‚ report_generator.py β”‚ β”œβ”€β”€ models/ β”‚ β”œβ”€β”€ utils/ β”‚ β”œβ”€β”€ core/ β”‚ └── main.py


---

# πŸ“Ή Input Sources

The system supports multiple input sources.

## Live Webcam
Laptop Webcam

↓

Real-time Analysis

Uploaded Video


Interview.mp4

↓

Offline Analysis


---

## IP Camera (Future)
RTSP Stream

↓

Analysis

πŸŽ₯ Video Processing Pipeline

Instead of extracting every frame and storing thousands of images,

the system processes the video as a stream.


Video

↓

VideoCapture

↓

Frame

↓

Analysis

↓

Discard

↓

Next Frame


Advantages

- Low memory usage
- Faster processing
- Real-time compatible

---

# πŸ–Ό Frame Source

Every frame enters the pipeline through a common interface.
Video

↓

FrameSource

↓

Generator

↓

Frame 1

↓

Frame 2

↓

Frame 3

This abstraction allows the same analysis code to work for

  • webcam
  • recorded video
  • RTSP streams

without modification.


πŸ‘€ Face Detection

Purpose

Determine whether a face is visible throughout the interview.

Output


Face Found

Bounding Box

Confidence

Face Visibility %


Technologies

- MediaPipe Face Detection

---

# πŸ˜€ Face Mesh

The most important module.

Instead of returning only a face,

MediaPipe Face Mesh returns
468 Facial Landmarks

Each landmark contains


x y z


These landmarks are shared across multiple downstream modules.
Face Mesh

↓

Landmarks

β”œβ”€β”€ Eye Contact

β”œβ”€β”€ Head Pose

β”œβ”€β”€ Expression

└── Face Visibility

The Face Mesh model is executed once per frame, and all modules reuse its output to avoid redundant computation.


πŸ‘€ Eye Contact Analysis

Using facial landmarks, the system estimates

  • Looking Left
  • Looking Right
  • Looking Up
  • Looking Down
  • Looking At Camera

Output


Eye Contact

82%

Looking Away

18%


---

# πŸ™‚ Facial Expression Analysis

Emotion recognition estimates

- Neutral
- Happy
- Smile
- Nervous
- Sad
- Angry
- Surprise

Future improvements

- FER
- Hume AI
- Azure Face API

---

# 🧠 Head Pose Estimation

The head orientation is represented using

- Pitch
- Yaw
- Roll
          Up

           β–²

Left ◄─────┼────► Right

           β–Ό

         Down

Metrics

  • Head Stability
  • Sudden Turns
  • Frequent Looking Down

🧍 Pose Estimation

MediaPipe Pose estimates

  • Neck
  • Shoulders
  • Elbows
  • Hips

The system determines

  • Upright
  • Leaning
  • Slouching

βœ‹ Hand Tracking

Tracks

  • Hand Visibility
  • Gesture Count
  • Natural Gestures
  • Excessive Gestures

🚢 Body Stability

The body is compared across consecutive frames.


Frame i

↓

Pose

↓

Frame i+1

↓

Pose

↓

Distance


Small distance

↓

Stable

Large distance

↓

Excessive movement

---

# πŸ“Έ Video Quality

Checks

- Brightness
- Blur
- Camera Angle
- Resolution
- FPS
- Background

---

# πŸ“Š Scoring Engine

Every module outputs metrics.

Example
Eye Contact

78%

Head Stability

90%


Posture

85%

These are combined into


Overall Interview Score


Possible weighting
Eye Contact        30%

Posture            20%

Expression         20%

Hand Movement      15%

Body Stability     10%

Video Quality       5%

πŸ“„ Report Generation

The report contains

  • Overall Score
  • Face Analysis
  • Eye Contact
  • Head Pose
  • Body Language
  • Video Quality
  • Personalized Coaching
  • Recommendations

Output formats

  • JSON
  • PDF
  • Dashboard

🌐 Frontend

Responsibilities

  • Record webcam
  • Upload interview
  • Live preview
  • Dashboard
  • Display metrics
  • Download report

Technologies

  • React
  • React Webcam
  • Tailwind CSS

βš™ Backend

Responsibilities

  • Receive uploads
  • Process video
  • Run MediaPipe
  • Calculate metrics
  • Generate reports

Technologies

  • FastAPI
  • OpenCV
  • MediaPipe
  • NumPy

πŸ“š Technologies

Category Technology
Backend FastAPI
Frontend React
Video OpenCV
Face Detection MediaPipe
Face Landmarks MediaPipe Face Mesh
Pose Estimation MediaPipe Pose
Hand Tracking MediaPipe Hands
Numerical Computing NumPy
Reporting Python

πŸš€ Future Improvements

  • Speech Analysis
  • Voice Emotion Recognition
  • Lip Synchronization
  • Object Detection
  • Eye Blink Rate
  • Attention Detection
  • Stress Detection
  • Real-time Dashboard
  • Multi-person Detection
  • Interview Difficulty Estimation
  • LLM-powered Coaching
  • Historical Performance Tracking
  • Resume-aware Feedback
  • Personalized Practice Sessions

πŸ’‘ Design Philosophy

The system follows a streaming pipeline architecture.

Instead of repeatedly running expensive AI models for each analysis task, each frame is processed once, producing reusable intermediate representations (such as facial landmarks and body keypoints). These intermediate results are then shared across specialized analysis modules.

This design provides:

  • High performance
  • Low memory consumption
  • Modular components
  • Easy extensibility
  • Support for both live and recorded interviews
  • Separation of concerns
  • Production-ready architecture

The goal is to build an extensible Computer Vision platform rather than a collection of independent scripts, making it straightforward to integrate new models, replace existing algorithms, or support additional input sources in the future.