
- Introduction
- Features
- Technology Stack
- Installation
- Usage
- Technical Details
- Contributing
- License
- Acknowledgments
Rachel HR Interview Bot is a cutting-edge, AI-powered interview preparation assistant designed to revolutionize the HR interview process for students, freshers, and experienced professionals. Developed by Sam Naveenkumar V (URK22AI1043) and Aravindan M (URK22AI1026) from the B.Tech Artificial Intelligence and Data Science program at Karunya Institute of Technology and Sciences, Rachel employs advanced natural language processing (NLP) techniques to provide a personalized and comprehensive interview experience.
This README file provides an in-depth overview of the project, its features, technical details, and instructions for setup and usage.
Rachel HR Interview Bot offers a wide range of features designed to enhance the interview preparation process:
- Resume Analysis: Utilizes PDF extraction and NLP techniques to analyze resumes and identify domains of specialization.
- Personalized Question Generation: Creates tailored technical HR interview questions based on the candidate's background, projects, and chosen job role.
- Interactive Chat Interface: Provides a user-friendly, WhatsApp-like chat interface for a seamless interview simulation experience.
- Answer Evaluation: Employs advanced algorithms to assess user responses and provide ratings on a scale of 0-10.
- Constructive Feedback: Offers detailed feedback on each answer, highlighting strengths and areas for improvement.
- Expected Answer Generation: Provides model answers to help users understand ideal responses to interview questions.
- GPU Acceleration: Utilizes CUDA for faster processing and improved performance.
- Customizable Job Roles: Supports a wide range of job roles across various engineering and scientific disciplines.
- Job Description Integration: Incorporates specific job descriptions to generate highly relevant interview questions.
- Chat History Backup: Allows users to save and review their interview sessions for future reference.
Rachel HR Interview Bot leverages a powerful combination of cutting-edge technologies:
- Python: The core programming language used for development.
- Gradio: For creating the user-friendly web interface.
- PyTorch: Utilized for GPU acceleration and deep learning capabilities.
- Llama-cpp: Implements the advanced language model for question generation and answer evaluation.
- spaCy: Provides natural language processing capabilities for text analysis.
- PyTextRank: Used for keyword extraction and text summarization.
- scikit-learn: Implements TF-IDF vectorization and cosine similarity for answer comparison.
- PyPDF2: Enables PDF parsing for resume analysis.
Rachel HR Interview Bot is built on a robust and scalable architecture, leveraging cutting-edge technologies:
+-------------------+ +------------------+ +------------------+
| User Interface | | Core Logic | | AI Engine |
| (Gradio Frontend) | <-> | (Python Backend) | <-> | (Llama 3.2 Model)|
+-------------------+ +------------------+ +------------------+
^ ^ ^
| | |
v v v
+-------------------+ +------------------+ +------------------+
| PDF Processor | | NLP Pipeline | | GPU Accelerator |
| (PyPDF2) | | (spaCy, TextRank)| | (CUDA) |
+-------------------+ +------------------+ +------------------+
Open WebUI can be installed using pip, the Python package installer. Before proceeding, ensure you're using Python 3.11 to avoid compatibility issues.
-
Install Open WebUI: Open your terminal and run the following command to install Open WebUI:
pip install open-webui
-
Running Open WebUI: After installation, you can start Open WebUI by executing:
open-webui serve
This will start the Open WebUI server, which you can access at http://localhost:8080
Note
Please note that for certain Docker environments, additional configurations might be needed. If you encounter any connection issues, our detailed guide on Open WebUI Documentation is ready to assist you.
Warning
When using Docker to install Open WebUI, make sure to include the -v open-webui:/app/backend/data
in your Docker command. This step is crucial as it ensures your database is properly mounted and prevents any loss of data.
Tip
If you wish to utilize Open WebUI with Ollama included or CUDA acceleration, we recommend utilizing our official images tagged with either :cuda
or :ollama
. To enable CUDA, you must install the Nvidia CUDA container toolkit on your Linux/WSL system.
-
If Ollama is on your computer, use this command:
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
-
If Ollama is on a Different Server, use this command:
To connect to Ollama on another server, change the
OLLAMA_BASE_URL
to the server's URL:docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=https://example.com -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
-
To run Open WebUI with Nvidia GPU support, use this command:
docker run -d -p 3000:8080 --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda
-
If you're only using OpenAI API, use this command:
docker run -d -p 3000:8080 -e OPENAI_API_KEY=your_secret_key -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
This installation method uses a single container image that bundles Open WebUI with Ollama, allowing for a streamlined setup via a single command. Choose the appropriate command based on your hardware setup:
-
With GPU Support: Utilize GPU resources by running the following command:
docker run -d -p 3000:8080 --gpus=all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama
-
For CPU Only: If you're not using a GPU, use this command instead:
docker run -d -p 3000:8080 -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama
Both commands facilitate a built-in, hassle-free installation of both Open WebUI and Ollama, ensuring that you can get everything up and running swiftly.
After installation, you can access Open WebUI at http://localhost:3000. Enjoy! π
We offer various installation alternatives, including non-Docker native installation methods, Docker Compose, Kustomize, and Helm. Visit our Open WebUI Documentation or join our Discord community for comprehensive guidance.
Encountering connection issues? Our Open WebUI Documentation has got you covered. For further assistance and to join our vibrant community, visit the Open WebUI Discord.
If you're experiencing connection issues, it's often due to the WebUI docker container not being able to reach the Ollama server at 127.0.0.1:11434 (host.docker.internal:11434) inside the container. Use the --network=host
flag in your docker command to resolve this. Note that the port changes from 3000 to 8080, resulting in the link: http://localhost:8080
.
Example Docker Command:
docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
In case you want to update your local Docker installation to the latest version, you can do it with Watchtower:
docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webui
In the last part of the command, replace open-webui
with your container name if it is different.
Check our Migration Guide available in our Open WebUI Documentation.
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
Install the NVIDIA Container Toolkit.
- Configure the repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
- Install the NVIDIA Container Toolkit packages
sudo apt-get install -y nvidia-container-toolkit
- Configure the repository
curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo \
| sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
- Install the NVIDIA Container Toolkit packages
sudo yum install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
To run Ollama using Docker with AMD GPUs, use the rocm
tag and the following command:
docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm
Now you can run a model:
docker exec -it ollama ollama run nemotron:70b-instruct-fp16
More models can be found on the Ollama library.
To launch Rachel HR Interview Bot:
- Activate the virtual environment (if not already activated).
- Run the main script:
python rachel_hr_bot.py
- Open the provided URL in your web browser to access the Gradio interface.
Using the interface:
- Upload your resume (PDF format) using the file input.
- Select your job role from the dropdown menu.
- Enter the job description in the provided text area.
- Click "Generate Questions" to start the interview simulation.
- Interact with Rachel by typing your answers in the chat input.
- Use the "Skip" button to move to the next question if needed.
- Click "Generate Answer" to see an expected answer for reference.
- After completing the interview, click "Provide Feedback" for a comprehensive evaluation.
The resume analysis function uses PyPDF2 to extract text from uploaded PDF files:
def extract_text_from_pdf(file):
try:
pdf_reader = PyPDF2.PdfReader(file)
text = ''
for page in pdf_reader.pages:
text += page.extract_text() + '\n'
return text.strip()
except Exception as e:
return f"Error extracting text from PDF: {str(e)}"
This function reads each page of the PDF and concatenates the extracted text, providing a clean string representation of the resume content.
The analyze_domain
function identifies the candidate's specialization based on keywords in the resume:
def analyze_domain(resume_text):
for domain in job_roles:
if domain.lower() in resume_text.lower():
return domain
return "General"
This simple yet effective approach matches resume content against predefined domains, allowing for accurate specialization detection.
Rachel uses the Llama model to generate tailored interview questions:
def generate_hr_questions(domain, job_role, job_description):
prompt = f"Generate 5 high-quality Technical HR interview questions for a candidate specializing in {domain} for the role of {job_role} with the following job description:\n{job_description}\nFocus on advanced concepts and industry best practices."
response = llm.create_chat_completion(
messages=[{"role": "user", "content": prompt}],
max_tokens=2048,
temperature=0.7,
)
questions = response['choices'][0]['message']['content'].strip().split('\n')
return [q.strip() for q in questions if q.strip()]
This function crafts a prompt using the candidate's domain, job role, and job description, then uses the Llama model to generate relevant technical questions.
The provide_feedback
function employs a sophisticated algorithm to evaluate user answers:
def provide_feedback(question, user_answer, expected_answer):
user_answer_lower = user_answer.lower()
expected_answer_lower = expected_answer.lower()
question_lower = question.lower()
user_keywords = set(extract_keywords_textrank(user_answer_lower))
expected_keywords = set(extract_keywords_textrank(expected_answer_lower))
question_keywords = set(extract_keywords_textrank(question_lower))
relevant_keywords = question_keywords.intersection(expected_keywords)
user_relevant_keywords = user_keywords.intersection(relevant_keywords)
keyword_relevance = len(user_relevant_keywords) / len(relevant_keywords) if relevant_keywords else 0
tfidf_matrix = tfidf_vectorizer.fit_transform([user_answer_lower, expected_answer_lower])
cosine_sim = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])[0][0]
final_score = (0.6 * keyword_relevance + 0.4 * cosine_sim) * 10
rating = round(final_score)
# ... (rating-based feedback generation)
return rating, suggestions + [feedback_details]
This function combines keyword analysis and TF-IDF cosine similarity to provide a comprehensive evaluation of the user's answer, generating both a numerical rating and constructive feedback.
Rachel utilizes CUDA for improved performance:
assert torch.cuda.is_available(), "CUDA is not available. Please check your GPU setup."
device = torch.device("cuda")
torch.cuda.set_device(0) # Use the first GPU
print(f"Using GPU: {torch.cuda.get_device_name(0)}")
# Initialize the Llama model with CUDA support
llm = Llama.from_pretrained(
repo_id="hugging-quants/Llama-3.2-3B-Instruct-Q8_0-GGUF",
filename="llama-3.2-3b-instruct-q8_0.gguf",
n_gpu_layers=-1, # Use all GPU layers
n_ctx=2048, # Adjust context size as needed
device=device
)
This setup ensures that the Llama model and other computations take full advantage of GPU acceleration, significantly improving processing speed.
Rachel's user interface is built using Gradio, providing a clean and intuitive experience:
with gr.Blocks(css=css) as demo:
gr.Markdown("# π KITS - Interview Prep Bot")
with gr.Row():
with gr.Column(scale=1):
with gr.Accordion("Resume Analysis", open=False):
file_input = gr.File(label="π Upload your resume (PDF)", file_types=['pdf'])
upload_button = gr.Button("π€ Upload and Analyze Resume")
upload_status = gr.Textbox(label="Status")
detected_domain = gr.Textbox(label="π― Detected Specialization")
job_role_dropdown = gr.Dropdown(label="π Select Job Role", choices=[])
job_description_input = gr.Textbox(label="π Enter Job Description (max 200 words)", max_lines=10)
generate_button = gr.Button("π Generate Questions", elem_classes=["generate-btn"])
feedback_button = gr.Button("π Provide Feedback", elem_classes=["feedback-btn"])
with gr.Column(scale=2):
chatbot = gr.Chatbot(label="π¬ Chat")
chat_input = gr.Textbox(label="Type your answer", placeholder="Type here or click 'Skip' to proceed")
with gr.Row():
chat_button = gr.Button("π¨ Send")
skip_button = gr.Button("π Skip")
generate_answer_button = gr.Button("π‘ Generate Answer")
# ... (state variables and event handlers)
This code structure creates a responsive layout with collapsible sections, stylized buttons, and a central chat interface, enhancing user experience and accessibility.
We welcome contributions to Rachel HR Interview Bot! If you'd like to contribute, please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Make your changes
- Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Please ensure your code adheres to the project's coding standards and include appropriate tests for new features.
This project is licensed under the MIT License. See the LICENSE
file for details.
- Sam Naveenkumar V (URK22AI1043) and Aravindan M (URK22AI1026) for their innovative development of Rachel HR Interview Bot.
- Karunya Institute of Technology and Sciences for supporting this project.
- The open-source community for providing the foundational libraries and models used in this project.
Rachel HR Interview Bot represents a significant advancement in AI-assisted interview preparation. By combining cutting-edge NLP techniques, GPU acceleration, and a user-friendly interface, Rachel offers a comprehensive solution for candidates looking to excel in technical HR interviews. We hope this tool proves invaluable in your career journey!