Spaces:
Configuration error
Configuration error
Upload 4 files
Browse files- .env.example +1 -0
- README.md +48 -12
- app.py +156 -0
- requirements.txt +7 -0
.env.example
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
GOOGLE_API_KEY="AIzaSyAMs9raAfrTFcOZU27pnEV-BAhZnCZgdpM"
|
README.md
CHANGED
@@ -1,12 +1,48 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AI Interview Preparation Assistant
|
2 |
+
|
3 |
+
An AI-powered application that helps candidates prepare for job interviews by analyzing resumes, conducting assessments, and providing personalized feedback.
|
4 |
+
|
5 |
+
## Features
|
6 |
+
|
7 |
+
- Resume and job description analysis
|
8 |
+
- Keyword extraction
|
9 |
+
- MCQ assessment
|
10 |
+
- Coding challenges
|
11 |
+
- AI-proctored mock interviews
|
12 |
+
- Speech-to-text conversion
|
13 |
+
- Comprehensive performance analysis
|
14 |
+
- Personalized learning recommendations
|
15 |
+
|
16 |
+
## Setup
|
17 |
+
|
18 |
+
1. Install dependencies:
|
19 |
+
```bash
|
20 |
+
pip install -r requirements.txt
|
21 |
+
```
|
22 |
+
|
23 |
+
2. Set up environment variables:
|
24 |
+
- Copy `.env.example` to `.env`
|
25 |
+
- Add your Google Gemini API key
|
26 |
+
|
27 |
+
3. Run the application:
|
28 |
+
```bash
|
29 |
+
streamlit run app.py
|
30 |
+
```
|
31 |
+
|
32 |
+
## Usage
|
33 |
+
|
34 |
+
1. Input your resume and the job description
|
35 |
+
2. Review the analysis and extracted keywords
|
36 |
+
3. Complete the MCQ assessment
|
37 |
+
4. Solve coding challenges
|
38 |
+
5. Participate in the mock interview
|
39 |
+
6. Review your comprehensive analysis and recommendations
|
40 |
+
|
41 |
+
## Requirements
|
42 |
+
|
43 |
+
- Python 3.8+
|
44 |
+
- Streamlit
|
45 |
+
- Google Generative AI (Gemini)
|
46 |
+
- SpeechRecognition
|
47 |
+
- PyAudio
|
48 |
+
- Internet connection for API calls
|
app.py
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
from utils.text_analysis import (
|
4 |
+
extract_keywords, generate_summary, generate_mcqs,
|
5 |
+
generate_coding_questions, analyze_interview_response,
|
6 |
+
get_learning_resources
|
7 |
+
)
|
8 |
+
from utils.audio_processor import convert_audio_to_text
|
9 |
+
|
10 |
+
def main():
|
11 |
+
st.title("AI Interview Preparation Assistant")
|
12 |
+
|
13 |
+
# Session state initialization
|
14 |
+
if 'current_step' not in st.session_state:
|
15 |
+
st.session_state.current_step = 1
|
16 |
+
|
17 |
+
# Step 1: Input Collection
|
18 |
+
if st.session_state.current_step == 1:
|
19 |
+
st.header("Step 1: Upload Resume and Job Description")
|
20 |
+
resume = st.text_area("Paste your resume here")
|
21 |
+
job_description = st.text_area("Paste the job description here")
|
22 |
+
|
23 |
+
if st.button("Analyze") and resume and job_description:
|
24 |
+
with st.spinner("Analyzing..."):
|
25 |
+
st.session_state.resume_summary = generate_summary(resume)
|
26 |
+
st.session_state.jd_summary = generate_summary(job_description)
|
27 |
+
st.session_state.keywords = extract_keywords(job_description)
|
28 |
+
st.session_state.current_step = 2
|
29 |
+
|
30 |
+
# Step 2: Summary and Keywords
|
31 |
+
elif st.session_state.current_step == 2:
|
32 |
+
st.header("Step 2: Analysis Results")
|
33 |
+
st.subheader("Resume Summary")
|
34 |
+
st.write(st.session_state.resume_summary)
|
35 |
+
|
36 |
+
st.subheader("Job Description Summary")
|
37 |
+
st.write(st.session_state.jd_summary)
|
38 |
+
|
39 |
+
st.subheader("Key Requirements")
|
40 |
+
st.write(", ".join(st.session_state.keywords))
|
41 |
+
|
42 |
+
if st.button("Start Assessment"):
|
43 |
+
st.session_state.current_step = 3
|
44 |
+
|
45 |
+
# Step 3: MCQ Assessment
|
46 |
+
elif st.session_state.current_step == 3:
|
47 |
+
st.header("Step 3: MCQ Assessment")
|
48 |
+
if 'mcqs' not in st.session_state:
|
49 |
+
with st.spinner("Generating questions..."):
|
50 |
+
st.session_state.mcqs = generate_mcqs(
|
51 |
+
st.session_state.resume_summary,
|
52 |
+
st.session_state.jd_summary
|
53 |
+
)
|
54 |
+
st.session_state.mcq_answers = {}
|
55 |
+
st.session_state.mcq_start_time = time.time()
|
56 |
+
|
57 |
+
# Display timer
|
58 |
+
elapsed_time = int(time.time() - st.session_state.mcq_start_time)
|
59 |
+
st.write(f"Time elapsed: {elapsed_time} seconds")
|
60 |
+
|
61 |
+
# Display MCQs
|
62 |
+
for i, mcq in enumerate(st.session_state.mcqs):
|
63 |
+
answer = st.radio(
|
64 |
+
f"Q{i+1}: {mcq['question']}",
|
65 |
+
mcq['options'],
|
66 |
+
key=f"mcq_{i}"
|
67 |
+
)
|
68 |
+
st.session_state.mcq_answers[i] = answer
|
69 |
+
|
70 |
+
if st.button("Submit MCQs"):
|
71 |
+
st.session_state.current_step = 4
|
72 |
+
|
73 |
+
# Step 4: Coding Assessment
|
74 |
+
elif st.session_state.current_step == 4:
|
75 |
+
st.header("Step 4: Coding Assessment")
|
76 |
+
if 'coding_questions' not in st.session_state:
|
77 |
+
with st.spinner("Generating coding questions..."):
|
78 |
+
st.session_state.coding_questions = generate_coding_questions(
|
79 |
+
st.session_state.resume_summary,
|
80 |
+
st.session_state.jd_summary
|
81 |
+
)
|
82 |
+
st.session_state.coding_start_time = time.time()
|
83 |
+
|
84 |
+
# Display timer
|
85 |
+
elapsed_time = int(time.time() - st.session_state.coding_start_time)
|
86 |
+
st.write(f"Time elapsed: {elapsed_time} seconds")
|
87 |
+
|
88 |
+
for i, question in enumerate(st.session_state.coding_questions):
|
89 |
+
st.subheader(f"Question {i+1}")
|
90 |
+
st.write(question['problem_statement'])
|
91 |
+
st.write("Examples:")
|
92 |
+
st.write(question['examples'])
|
93 |
+
st.write("Constraints:")
|
94 |
+
st.write(question['constraints'])
|
95 |
+
|
96 |
+
if 'coding_answers' not in st.session_state:
|
97 |
+
st.session_state.coding_answers = {}
|
98 |
+
|
99 |
+
st.session_state.coding_answers[i] = st.text_area(
|
100 |
+
"Your solution:",
|
101 |
+
key=f"coding_{i}"
|
102 |
+
)
|
103 |
+
|
104 |
+
if st.button("Submit Coding Solutions"):
|
105 |
+
st.session_state.current_step = 5
|
106 |
+
|
107 |
+
# Step 5: Mock Interview
|
108 |
+
elif st.session_state.current_step == 5:
|
109 |
+
st.header("Step 5: Mock Interview")
|
110 |
+
st.write("Click 'Start' when ready to begin the interview.")
|
111 |
+
|
112 |
+
if st.button("Start Interview"):
|
113 |
+
st.write("Recording... Speak your answer.")
|
114 |
+
audio_text = convert_audio_to_text()
|
115 |
+
|
116 |
+
with st.spinner("Analyzing your response..."):
|
117 |
+
st.session_state.interview_analysis = analyze_interview_response(
|
118 |
+
audio_text,
|
119 |
+
st.session_state.jd_summary
|
120 |
+
)
|
121 |
+
st.session_state.current_step = 6
|
122 |
+
|
123 |
+
# Step 6: Final Analysis
|
124 |
+
elif st.session_state.current_step == 6:
|
125 |
+
st.header("Final Analysis")
|
126 |
+
|
127 |
+
# Calculate overall score
|
128 |
+
mcq_score = sum(1 for i, ans in st.session_state.mcq_answers.items()
|
129 |
+
if ans == st.session_state.mcqs[i]['correct_answer'])
|
130 |
+
interview_score = st.session_state.interview_analysis['score']
|
131 |
+
|
132 |
+
overall_score = (mcq_score / 30 * 0.4 + interview_score / 100 * 0.6) * 100
|
133 |
+
|
134 |
+
st.subheader("Overall Match Score")
|
135 |
+
st.progress(overall_score / 100)
|
136 |
+
st.write(f"{overall_score:.1f}%")
|
137 |
+
|
138 |
+
st.subheader("Strengths")
|
139 |
+
st.write(st.session_state.interview_analysis['strengths'])
|
140 |
+
|
141 |
+
st.subheader("Areas for Improvement")
|
142 |
+
st.write(st.session_state.interview_analysis['improvements'])
|
143 |
+
|
144 |
+
# Get learning resources
|
145 |
+
resources = get_learning_resources(
|
146 |
+
st.session_state.interview_analysis['concepts_to_study']
|
147 |
+
)
|
148 |
+
|
149 |
+
st.subheader("Recommended Learning Resources")
|
150 |
+
for concept, links in resources.items():
|
151 |
+
st.write(f"**{concept}:**")
|
152 |
+
for link in links:
|
153 |
+
st.write(f"- {link}")
|
154 |
+
|
155 |
+
if __name__ == "__main__":
|
156 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit==1.32.0
|
2 |
+
google-generativeai==0.3.2
|
3 |
+
python-dotenv==1.0.1
|
4 |
+
speechrecognition==3.10.1
|
5 |
+
pyaudio==0.2.14
|
6 |
+
pandas==2.2.1
|
7 |
+
numpy==1.26.4
|