-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.py
More file actions
232 lines (186 loc) · 6.37 KB
/
demo.py
File metadata and controls
232 lines (186 loc) · 6.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
"""
Demo script to showcase the Interview Intelligence System
Run this to test the system without the web interface
"""
import sys
from pathlib import Path
# Add src to path
sys.path.append(str(Path(__file__).parent))
from src.config import validate_config
def print_banner():
"""Print welcome banner"""
banner = """
╔═══════════════════════════════════════════════════════════╗
║ ║
║ 🎯 AI-Powered Interview Intelligence System 🎯 ║
║ ║
║ Professional Multimodal Interview Evaluation Platform ║
║ ║
╚═══════════════════════════════════════════════════════════╝
"""
print(banner)
def check_system():
"""Check system requirements and module availability"""
print("\n" + "=" * 60)
print("SYSTEM CHECK")
print("=" * 60)
# Check Python version
import sys
print(f"✓ Python version: {sys.version.split()[0]}")
# Check core dependencies
dependencies = {
"numpy": "NumPy",
"cv2": "OpenCV",
"librosa": "Librosa",
"streamlit": "Streamlit"
}
for module_name, display_name in dependencies.items():
try:
__import__(module_name)
print(f"✓ {display_name} installed")
except ImportError:
print(f"✗ {display_name} not installed")
# Check optional dependencies
print("\nOptional AI Models:")
try:
import whisper
print("✓ Whisper (Speech-to-Text)")
except ImportError:
print("✗ Whisper not installed - install with: pip install openai-whisper")
try:
from sentence_transformers import SentenceTransformer
print("✓ Sentence Transformers (NLP)")
except ImportError:
print("✗ Sentence Transformers not installed - install with: pip install sentence-transformers")
try:
import mediapipe
print("✓ MediaPipe (Face Analysis)")
except ImportError:
print("✗ MediaPipe not installed - install with: pip install mediapipe")
# Validate configuration
print("\nConfiguration:")
try:
validate_config()
print("✓ Configuration valid")
except Exception as e:
print(f"✗ Configuration error: {e}")
print("=" * 60)
def show_architecture():
"""Display system architecture"""
print("\n" + "=" * 60)
print("SYSTEM ARCHITECTURE")
print("=" * 60)
arch = """
Video Input
↓
[Video Processor] → Extract Audio + Frames
↓ ↓
[Transcriber] [Face Analyzer]
↓ ↓
[Audio Analyzer] [Engagement Metrics]
↓ ↓
[NLP Evaluator] ← Transcript
↓
[Scoring Engine] ← Combines All Signals
↓
Final Report + Recommendations
"""
print(arch)
print("=" * 60)
def show_module_info():
"""Show information about each module"""
print("\n" + "=" * 60)
print("MODULE OVERVIEW")
print("=" * 60)
modules = {
"video_processor.py": "Extracts audio and frames from video files",
"transcriber.py": "Converts speech to text using Whisper",
"audio_analysis.py": "Analyzes speech patterns, fluency, confidence",
"nlp_evaluator.py": "Evaluates answer quality, relevance, clarity",
"face_analysis.py": "Analyzes facial engagement and eye contact",
"scoring_engine.py": "Combines all signals into final score"
}
for module, description in modules.items():
print(f"\n📄 {module}")
print(f" {description}")
print("\n" + "=" * 60)
def show_usage():
"""Show usage examples"""
print("\n" + "=" * 60)
print("USAGE EXAMPLES")
print("=" * 60)
print("\n1. Web Application (Recommended):")
print(" $ streamlit run app.py")
print("\n2. Python API:")
print("""
from src.pipeline import analyze_interview
results = analyze_interview(
video_path="interview.mp4",
question="Tell me about your experience",
expected_keywords=["python", "teamwork"]
)
print(f"Score: {results['final_score']['final_score']:.2%}")
""")
print("\n3. Command Line:")
print("""
python -c "from src.pipeline import analyze_interview; \\
analyze_interview('video.mp4')"
""")
print("\n" + "=" * 60)
def show_scoring():
"""Show scoring methodology"""
print("\n" + "=" * 60)
print("SCORING METHODOLOGY")
print("=" * 60)
print("""
Final Score = Weighted Average of:
• NLP Score (35%)
- Content relevance to question
- Answer clarity and structure
- Technical depth
- Keyword coverage
• Speech Score (30%)
- Vocal confidence
- Speech rate (optimal: 120-160 WPM)
- Filler word usage
- Pause patterns
• Facial Score (20%)
- Eye contact quality
- Head stability
- Visual engagement
- Face detection consistency
• Structure Score (15%)
- Answer organization
- Logical flow
- Introduction and conclusion
- Coherence
Grading Scale:
A (Excellent): 85%+
B (Good): 70-84%
C (Average): 55-69%
D (Needs Improvement): 40-54%
F (Poor): <40%
""")
print("=" * 60)
def main():
"""Main demo function"""
print_banner()
check_system()
show_architecture()
show_module_info()
show_scoring()
show_usage()
print("\n" + "=" * 60)
print("READY TO START!")
print("=" * 60)
print("\nTo begin analysis:")
print(" 1. Run: streamlit run app.py")
print(" 2. Upload an interview video")
print(" 3. View comprehensive results\n")
print("For questions or issues:")
print(" - Check README.md for documentation")
print(" - Review src/config.py for settings")
print(" - Run tests with: pytest tests/")
print("\n" + "=" * 60)
if __name__ == "__main__":
main()