Spaces:
Paused
Paused
File size: 7,372 Bytes
76030db 504df0f 76030db 504df0f 76030db 504df0f 76030db 504df0f 76030db 504df0f 76030db 504df0f 76030db |
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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# Codingo - AI Powered Smart Recruitment System
This repository contains the implementation of Codingo, an AI-powered online recruitment platform designed to automate and enhance the hiring process through a virtual HR assistant named LUNA.
## Project Overview
Codingo addresses the challenges of traditional recruitment processes by offering:
- Automated CV screening and skill-based shortlisting
- AI-led interviews through the virtual assistant LUNA
- Real-time cheating detection during assessments
- Gamified practice tools for candidates
- Secure administration interface for hiring managers
## Getting Started
This guide outlines the development process, starting with local model training before moving to AWS deployment.
### Prerequisites
- Python 3.8+
- pip (Python package manager)
- Git
### Development Process
We'll implement the project in phases:
#### Phase 1: Local Training and Feature Extraction (Current Phase)
This initial phase focuses on building and training the model locally before AWS deployment.
### Project Structure
```
Codingo/
βββ backend/ # Flask API backend
β βββ app.py # Flask server
β βββ predict.py # Predict using trained model
β βββ train_model.py # Model training script
β βββ model/ # Trained model artifacts
β β βββ cv_classifier.pkl
β βββ utils/
β β βββ text_extractor.py # PDF/DOCX to text
β β βββ preprocessor.py # Cleaning, tokenizing
β
βββ data/
β βββ training.csv # Your training dataset
β βββ raw_cvs/ # CV files (PDF/DOCX/txt)
β
βββ notebooks/
β βββ eda.ipynb # Data exploration & feature work
β
βββ requirements.txt # Python dependencies
βββ README.md # Project overview
```
## Step-by-Step Implementation Guide
### Step 1: Create Training Dataset
Start by manually collecting ~50-100 CV-like text samples with position labels.
**File:** `data/training.csv`
Example format:
```
text,position
"Experienced in Python, Flask, AWS",Backend Developer
"Built dashboards with React and TypeScript",Frontend Developer
"ML projects using pandas, scikit-learn",Data Scientist
```
### Step 2: Train Model
Implement a classifier using scikit-learn to predict job roles from CV text.
**File:** `backend/train_model.py`
```python
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
import joblib
# Load training data
df = pd.read_csv('data/training.csv')
# Define model pipeline
model = Pipeline([
('tfidf', TfidfVectorizer(max_features=5000, ngram_range=(1, 2))),
('classifier', LogisticRegression(max_iter=1000))
])
# Train model
model.fit(df['text'], df['position'])
# Save model
joblib.dump(model, 'backend/models/cv_classifier.pkl')
print("Model trained and saved successfully!")
```
### Step 3: Test Prediction Locally
Create a script to verify your model works correctly.
**File:** `backend/predict.py`
```python
import joblib
import sys
def predict_role(cv_text):
# Load the trained model
model = joblib.load('backend/models/cv_classifier.pkl')
# Make prediction
prediction = model.predict([cv_text])[0]
confidence = max(model.predict_proba([cv_text])[0]) * 100
return {
'predicted_position': prediction,
'confidence': f"{confidence:.2f}%"
}
if __name__ == "__main__":
if len(sys.argv) > 1:
# Get CV text from command line argument
cv_text = sys.argv[1]
else:
# Example CV text
cv_text = "Experienced Python developer with 5 years of experience in Flask and AWS."
result = predict_role(cv_text)
print(f"Predicted Position: {result['predicted_position']}")
print(f"Confidence: {result['confidence']}")
```
### Step 4: Add Text Extraction Utility
Create utilities to extract text from PDF and DOCX files.
**File:** `backend/utils/text_extractor.py`
```python
import fitz # PyMuPDF
import docx
import os
def extract_text_from_pdf(path):
"""Extract text from PDF file."""
doc = fitz.open(path)
text = ""
for page in doc:
text += page.get_text()
return text.strip()
def extract_text_from_docx(path):
"""Extract text from DOCX file."""
doc = docx.Document(path)
text = "\n".join([paragraph.text for paragraph in doc.paragraphs])
return text.strip()
def extract_text(file_path):
"""Extract text from either PDF or DOCX."""
extension = os.path.splitext(file_path)[1].lower()
if extension == '.pdf':
return extract_text_from_pdf(file_path)
elif extension in ['.docx', '.doc']:
return extract_text_from_docx(file_path)
elif extension == '.txt':
with open(file_path, 'r', encoding='utf-8') as f:
return f.read().strip()
else:
raise ValueError(f"Unsupported file extension: {extension}")
```
### Step 5: Add Flask API (Simple)
Create a basic Flask API to accept CV uploads and return predictions.
**File:** `backend/app.py`
```python
from flask import Flask, request, jsonify
from utils.text_extractor import extract_text
import joblib
import os
app = Flask(__name__)
model = joblib.load("model/cv_classifier.pkl")
# Ensure directories exist
os.makedirs("data/raw_cvs", exist_ok=True)
os.makedirs("model", exist_ok=True)
@app.route("/predict", methods=["POST"])
def predict():
if 'file' not in request.files:
return jsonify({"error": "No file provided"}), 400
file = request.files["file"]
file_path = f"data/raw_cvs/{file.filename}"
file.save(file_path)
try:
text = extract_text(file_path)
prediction = model.predict([text])[0]
confidence = max(model.predict_proba([text])[0]) * 100
return jsonify({
"predicted_position": prediction,
"confidence": f"{confidence:.2f}%"
})
except Exception as e:
return jsonify({"error": str(e)}), 500
if __name__ == "__main__":
app.run(debug=True)
```
### Step 6: Install Dependencies
**File:** `requirements.txt`
```
flask
scikit-learn
pandas
joblib
PyMuPDF
python-docx
```
Run: `pip install -r requirements.txt`
## Next Steps
After completing Phase 1, we'll move to:
1. **Phase 2: Enhanced Model & NLP Features**
- Implement BERT or DistilBERT for improved semantic understanding
- Add skill extraction from CVs
- Develop job-CV matching scoring
2. **Phase 3: Web Interface & Chatbot**
- Develop user interface for admin and candidates
- Implement LUNA virtual assistant using LangChain
- Add interview scheduling functionality
3. **Phase 4: Video Interview & Proctoring**
- Add video interview capabilities
- Implement cheating detection using computer vision
- Develop automated scoring system
4. **Phase 5: AWS Deployment**
- Set up AWS infrastructure using Terraform
- Deploy application to EC2/Lambda
- Configure S3 for file storage
## Authors
- Hussein El Saadi
- Nour Ali Shaito
## Supervisor
- Dr. Ali Ezzedine
## License
This project is licensed under the MIT License - see the LICENSE file for details.
|