RainPoo
commited on
Commit
•
85d8db3
0
Parent(s):
First commit
Browse files- .gitignore +162 -0
- .idea/.gitignore +3 -0
- .idea/material_theme_project_new.xml +12 -0
- .idea/vcs.xml +4 -0
- README.md +1 -0
- main.py +16 -0
- requirements.txt +2 -0
- src/domain/candidate.py +12 -0
- src/domain/emotion_metrics.py +14 -0
- src/domain/enums/emotion_types.py +18 -0
- src/domain/enums/interview_status.py +10 -0
- src/domain/interview.py +24 -0
- src/domain/resume.py +12 -0
- src/frontend/interface.py +52 -0
- src/service/interview_analyzer.py +27 -0
- tests/conftest.py +14 -0
- tests/test_base.py +5 -0
.gitignore
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
110 |
+
.pdm.toml
|
111 |
+
.pdm-python
|
112 |
+
.pdm-build/
|
113 |
+
|
114 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
115 |
+
__pypackages__/
|
116 |
+
|
117 |
+
# Celery stuff
|
118 |
+
celerybeat-schedule
|
119 |
+
celerybeat.pid
|
120 |
+
|
121 |
+
# SageMath parsed files
|
122 |
+
*.sage.py
|
123 |
+
|
124 |
+
# Environments
|
125 |
+
.env
|
126 |
+
.venv
|
127 |
+
env/
|
128 |
+
venv/
|
129 |
+
ENV/
|
130 |
+
env.bak/
|
131 |
+
venv.bak/
|
132 |
+
|
133 |
+
# Spyder project settings
|
134 |
+
.spyderproject
|
135 |
+
.spyproject
|
136 |
+
|
137 |
+
# Rope project settings
|
138 |
+
.ropeproject
|
139 |
+
|
140 |
+
# mkdocs documentation
|
141 |
+
/site
|
142 |
+
|
143 |
+
# mypy
|
144 |
+
.mypy_cache/
|
145 |
+
.dmypy.json
|
146 |
+
dmypy.json
|
147 |
+
|
148 |
+
# Pyre type checker
|
149 |
+
.pyre/
|
150 |
+
|
151 |
+
# pytype static type analyzer
|
152 |
+
.pytype/
|
153 |
+
|
154 |
+
# Cython debug symbols
|
155 |
+
cython_debug/
|
156 |
+
|
157 |
+
# PyCharm
|
158 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
159 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
160 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
161 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
162 |
+
#.idea/
|
.idea/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
.idea/material_theme_project_new.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="MaterialThemeProjectNewConfig">
|
4 |
+
<option name="metadata">
|
5 |
+
<MTProjectMetadataState>
|
6 |
+
<option name="migrated" value="true" />
|
7 |
+
<option name="pristineConfig" value="false" />
|
8 |
+
<option name="userId" value="-2584fe07:1911e531909:-7ffe" />
|
9 |
+
</MTProjectMetadataState>
|
10 |
+
</option>
|
11 |
+
</component>
|
12 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings" defaultProject="true" />
|
4 |
+
</project>
|
README.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# Automated-Interview-Filtering
|
main.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This is a sample Python script.
|
2 |
+
|
3 |
+
# Press ⌃R to execute it or replace it with your code.
|
4 |
+
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
|
5 |
+
|
6 |
+
|
7 |
+
def print_hi(name):
|
8 |
+
# Use a breakpoint in the code line below to debug your script.
|
9 |
+
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
|
10 |
+
|
11 |
+
|
12 |
+
# Press the green button in the gutter to run the script.
|
13 |
+
if __name__ == '__main__':
|
14 |
+
print_hi('PyCharm')
|
15 |
+
|
16 |
+
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio==5.6.0
|
2 |
+
gradio_client==1.4.3
|
src/domain/candidate.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from typing import Dict, List
|
3 |
+
|
4 |
+
@dataclass
|
5 |
+
class Candidate:
|
6 |
+
id: str
|
7 |
+
name: str
|
8 |
+
email: str
|
9 |
+
resume_data: Dict
|
10 |
+
interview_responses: List[str]
|
11 |
+
emotional_metrics: Dict
|
12 |
+
feedback: Dict
|
src/domain/emotion_metrics.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from typing import List, Dict
|
3 |
+
|
4 |
+
@dataclass
|
5 |
+
class EmotionMetrics:
|
6 |
+
confidence_score: float
|
7 |
+
engagement_level: float
|
8 |
+
emotional_stability: float
|
9 |
+
stress_indicators: List[str]
|
10 |
+
dominant_emotions: Dict[str, float]
|
11 |
+
|
12 |
+
def calculate_overall_score(self) -> float:
|
13 |
+
# Implementation for calculating overall emotional score
|
14 |
+
pass
|
src/domain/enums/emotion_types.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from enum import Enum
|
2 |
+
|
3 |
+
class EmotionType(Enum):
|
4 |
+
HAPPY = "happy"
|
5 |
+
SAD = "sad"
|
6 |
+
ANGRY = "angry"
|
7 |
+
NEUTRAL = "neutral"
|
8 |
+
SURPRISED = "surprised"
|
9 |
+
FEARFUL = "fearful"
|
10 |
+
DISGUSTED = "disgusted"
|
11 |
+
|
12 |
+
@classmethod
|
13 |
+
def get_positive_emotions(cls):
|
14 |
+
return [cls.HAPPY, cls.NEUTRAL]
|
15 |
+
|
16 |
+
@classmethod
|
17 |
+
def get_negative_emotions(cls):
|
18 |
+
return [cls.SAD, cls.ANGRY, cls.FEARFUL, cls.DISGUSTED]
|
src/domain/enums/interview_status.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from enum import Enum, auto
|
2 |
+
|
3 |
+
class InterviewStatus(Enum):
|
4 |
+
SCHEDULED = auto()
|
5 |
+
IN_PROGRESS = auto()
|
6 |
+
COMPLETED = auto()
|
7 |
+
CANCELLED = auto()
|
8 |
+
PENDING_REVIEW = auto()
|
9 |
+
REVIEWED = auto()
|
10 |
+
FAILED = auto()
|
src/domain/interview.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from datetime import datetime
|
3 |
+
from typing import List, Dict
|
4 |
+
from src.domain.enums.interview_status import InterviewStatus
|
5 |
+
from src.domain.enums.emotion_types import EmotionType
|
6 |
+
|
7 |
+
@dataclass
|
8 |
+
class Interview:
|
9 |
+
id: str
|
10 |
+
candidate_id: str
|
11 |
+
job_id: str
|
12 |
+
video_path: str
|
13 |
+
status: InterviewStatus
|
14 |
+
questions: List[str]
|
15 |
+
responses_transcription: List[str]
|
16 |
+
timestamp: datetime
|
17 |
+
duration: int
|
18 |
+
emotional_analysis: Dict[EmotionType, float]
|
19 |
+
|
20 |
+
def is_completed(self) -> bool:
|
21 |
+
return self.status == InterviewStatus.COMPLETED
|
22 |
+
|
23 |
+
def is_reviewable(self) -> bool:
|
24 |
+
return self.status in [InterviewStatus.COMPLETED, InterviewStatus.PENDING_REVIEW]
|
src/domain/resume.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from typing import List, Dict
|
3 |
+
|
4 |
+
@dataclass
|
5 |
+
class Resume:
|
6 |
+
id: str
|
7 |
+
candidate_id: str
|
8 |
+
file_path: str
|
9 |
+
parsed_content: Dict
|
10 |
+
skills: List[str]
|
11 |
+
experience: List[Dict]
|
12 |
+
education: List[Dict]
|
src/frontend/interface.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from typing import Dict
|
3 |
+
from src.application.services import InterviewAnalyzer
|
4 |
+
from src.infrastructure.llm import LangchainService
|
5 |
+
from src.infrastructure.emotion import DeepFaceService
|
6 |
+
from src.infrastructure.speech import GoogleSpeechService
|
7 |
+
|
8 |
+
class GradioInterface:
|
9 |
+
def __init__(self):
|
10 |
+
# Initialize services
|
11 |
+
self.emotion_service = DeepFaceService()
|
12 |
+
self.speech_service = GoogleSpeechService()
|
13 |
+
self.llm_service = LangchainService()
|
14 |
+
|
15 |
+
# Initialize analyzer
|
16 |
+
self.analyzer = InterviewAnalyzer(
|
17 |
+
emotion_service=self.emotion_service,
|
18 |
+
speech_service=self.speech_service,
|
19 |
+
llm_service=self.llm_service
|
20 |
+
)
|
21 |
+
|
22 |
+
def create_interface(self) -> gr.Interface:
|
23 |
+
def process_submission(
|
24 |
+
video_file: str,
|
25 |
+
resume_file: str,
|
26 |
+
job_requirements: str
|
27 |
+
) -> Dict:
|
28 |
+
# Implementation for processing submission
|
29 |
+
pass
|
30 |
+
|
31 |
+
# Create Gradio interface
|
32 |
+
interface = gr.Interface(
|
33 |
+
fn=process_submission,
|
34 |
+
inputs=[
|
35 |
+
gr.Video(label="Interview Recording"),
|
36 |
+
gr.File(label="Resume"),
|
37 |
+
gr.Textbox(label="Job Requirements", lines=5)
|
38 |
+
],
|
39 |
+
outputs=gr.JSON(label="Analysis Results"),
|
40 |
+
title="HR Interview Analysis System",
|
41 |
+
description="Upload interview recording and resume to analyze candidate performance"
|
42 |
+
)
|
43 |
+
|
44 |
+
return interface
|
45 |
+
|
46 |
+
def launch_app():
|
47 |
+
app = GradioInterface()
|
48 |
+
interface = app.create_interface()
|
49 |
+
interface.launch()
|
50 |
+
|
51 |
+
if __name__ == "__main__":
|
52 |
+
launch_app()
|
src/service/interview_analyzer.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.domain.enums.file_types import VideoFileType
|
2 |
+
from src.domain.enums.emotion_types import EmotionType
|
3 |
+
from src.domain.entities.interview import Interview
|
4 |
+
from typing import Dict, List
|
5 |
+
|
6 |
+
class InterviewAnalyzer:
|
7 |
+
def validate_video(self, video_path: str) -> bool:
|
8 |
+
file_extension = video_path[video_path.rfind("."):]
|
9 |
+
return VideoFileType.validate_format(file_extension)
|
10 |
+
|
11 |
+
def analyze_emotions(self, emotion_data: Dict[str, float]) -> Dict[EmotionType, float]:
|
12 |
+
analyzed_emotions = {}
|
13 |
+
for emotion_name, score in emotion_data.items():
|
14 |
+
try:
|
15 |
+
emotion_type = EmotionType(emotion_name.lower())
|
16 |
+
analyzed_emotions[emotion_type] = score
|
17 |
+
except ValueError:
|
18 |
+
continue
|
19 |
+
return analyzed_emotions
|
20 |
+
|
21 |
+
def get_dominant_emotion(self, emotion_scores: Dict[EmotionType, float]) -> EmotionType:
|
22 |
+
return max(emotion_scores.items(), key=lambda x: x[1])[0]
|
23 |
+
|
24 |
+
def is_positive_response(self, emotion_scores: Dict[EmotionType, float]) -> bool:
|
25 |
+
positive_emotions = EmotionType.get_positive_emotions()
|
26 |
+
dominant_emotion = self.get_dominant_emotion(emotion_scores)
|
27 |
+
return dominant_emotion in positive_emotions
|
tests/conftest.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
import pytest
|
3 |
+
|
4 |
+
|
5 |
+
# each test runs on cwd to its temp dir
|
6 |
+
@pytest.fixture(autouse=True)
|
7 |
+
def go_to_tmpdir(request):
|
8 |
+
# Get the fixture dynamically by its name.
|
9 |
+
tmpdir = request.getfixturevalue("tmpdir")
|
10 |
+
# ensure local test created packages can be imported
|
11 |
+
sys.path.insert(0, str(tmpdir))
|
12 |
+
# Chdir only for the duration of the test.
|
13 |
+
with tmpdir.as_cwd():
|
14 |
+
yield
|
tests/test_base.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from project_name.base import NAME
|
2 |
+
|
3 |
+
|
4 |
+
def test_base():
|
5 |
+
assert NAME == "project_name"
|