rashid01 commited on
Commit
2fc2874
·
verified ·
1 Parent(s): 1791550

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -43
app.py CHANGED
@@ -44,7 +44,7 @@ def generate_questions(model_choice, role, question_type, num_questions, difficu
44
  elif model_choice == "Gemini":
45
  llm = get_llm(model_choice)
46
  response = llm.invoke(prompt)
47
- return response.content.strip().split("\n")
48
  else:
49
  raise ValueError("Unsupported model choice.")
50
 
@@ -210,14 +210,16 @@ st.markdown(
210
  .stButton>button:hover {
211
  background-color: #45a049;
212
  }
213
- .progress-container {
214
- padding: 15px;
215
- background-color: #f1f8e9;
216
  border-radius: 8px;
217
- border: 1px solid #c5e1a5;
218
- margin-bottom: 20px;
 
219
  }
220
- .output-container {
 
 
221
  padding: 15px;
222
  margin: 15px 0;
223
  background-color: #e3f2fd;
@@ -225,8 +227,6 @@ st.markdown(
225
  .sidebar {
226
  background-color: #ffffff; /* Sidebar background color */
227
  padding: 1em;
228
- max-height: 600px; /* Adjust height for scrolling */
229
- overflow-y: auto;
230
  }
231
  .footer {
232
  background-color: #4CAF50;
@@ -271,17 +271,7 @@ with st.sidebar:
271
  st.title("💼 TechPrep")
272
 
273
  model_choice = st.selectbox("Select AI Model", ["Gemini", "OpenAI"], key="select_model")
274
-
275
- # Updated role dropdown with scrollable feature
276
- roles = [
277
- "Software Developer", "Data Analyst", "Marketing Manager", "Project Manager", "UX Designer",
278
- "Machine Learning Engineer", "Data Scientist", "AI Researcher", "Product Manager", "Business Analyst",
279
- "Web Developer", "Mobile App Developer", "Cloud Engineer", "DevOps Engineer", "System Analyst",
280
- "Database Administrator", "Cybersecurity Specialist", "QA Engineer", "IT Support Specialist", "Network Engineer",
281
- "Graphic Designer"
282
- ]
283
- role = st.selectbox("Select Role", roles, key="select_role")
284
-
285
  question_type = st.selectbox("Select Question Type", ["Behavioral", "Technical", "Situational", "Case Study", "Problem Solving"], key="select_question_type")
286
  num_questions = st.slider("Number of Questions", 1, 10, key="slider_num_questions")
287
  difficulty = st.selectbox("Select Difficulty Level", ["Easy", "Medium", "Hard"], key="select_difficulty")
@@ -290,30 +280,23 @@ st.header("📝 Generate Interview Questions")
290
  if st.button("Generate Questions", key="generate_questions"):
291
  with st.spinner("Generating questions..."):
292
  questions = generate_questions(model_choice, role, question_type, num_questions, difficulty)
293
-
294
- # Paginate questions
295
- if "question_index" not in st.session_state:
296
- st.session_state.question_index = 0
297
-
298
- if "questions" not in st.session_state:
299
- st.session_state.questions = questions
300
-
301
- total_questions = len(st.session_state.questions)
302
- if total_questions > 0:
303
- st.markdown(style_output(f"Question {st.session_state.question_index + 1} of {total_questions}:", "#4CAF50"), unsafe_allow_html=True)
304
- st.write(st.session_state.questions[st.session_state.question_index])
305
 
306
- col1, col2 = st.columns(2)
307
- with col1:
308
- if st.session_state.question_index > 0:
309
- if st.button("Previous Question"):
310
- st.session_state.question_index -= 1
311
-
312
- with col2:
313
- if st.session_state.question_index < total_questions - 1:
314
- if st.button("Next Question"):
315
- st.session_state.question_index += 1
316
-
317
  progress_data["questions_solved"][question_type] += num_questions
318
 
319
  st.header("🗣️ Provide Feedback")
@@ -353,3 +336,4 @@ st.markdown("""
353
  </div>
354
  """, unsafe_allow_html=True)
355
 
 
 
44
  elif model_choice == "Gemini":
45
  llm = get_llm(model_choice)
46
  response = llm.invoke(prompt)
47
+ return response.content.split("\n")
48
  else:
49
  raise ValueError("Unsupported model choice.")
50
 
 
210
  .stButton>button:hover {
211
  background-color: #45a049;
212
  }
213
+ .output-container {
214
+ border: 2px solid #2196F3;
 
215
  border-radius: 8px;
216
+ padding: 15px;
217
+ margin: 15px 0;
218
+ background-color: #f1f1f1;
219
  }
220
+ .progress-container {
221
+ border: 2px solid #2196F3;
222
+ border-radius: 8px;
223
  padding: 15px;
224
  margin: 15px 0;
225
  background-color: #e3f2fd;
 
227
  .sidebar {
228
  background-color: #ffffff; /* Sidebar background color */
229
  padding: 1em;
 
 
230
  }
231
  .footer {
232
  background-color: #4CAF50;
 
271
  st.title("💼 TechPrep")
272
 
273
  model_choice = st.selectbox("Select AI Model", ["Gemini", "OpenAI"], key="select_model")
274
+ role = st.selectbox("Select Role", ["GenAI Engineer", "Machine Learning Engineer", "Data Scientist", "Software Developer", "Marketing Manager"], key="select_role")
 
 
 
 
 
 
 
 
 
 
275
  question_type = st.selectbox("Select Question Type", ["Behavioral", "Technical", "Situational", "Case Study", "Problem Solving"], key="select_question_type")
276
  num_questions = st.slider("Number of Questions", 1, 10, key="slider_num_questions")
277
  difficulty = st.selectbox("Select Difficulty Level", ["Easy", "Medium", "Hard"], key="select_difficulty")
 
280
  if st.button("Generate Questions", key="generate_questions"):
281
  with st.spinner("Generating questions..."):
282
  questions = generate_questions(model_choice, role, question_type, num_questions, difficulty)
283
+ if questions:
284
+ question_index = st.session_state.get('question_index', 0)
285
+ st.session_state['questions'] = questions
286
+ st.session_state['question_index'] = question_index
287
+ st.session_state['questions_count'] = len(questions)
 
 
 
 
 
 
 
288
 
289
+ if question_index < len(questions):
290
+ st.markdown(style_output("Question:", "#4CAF50"), unsafe_allow_html=True)
291
+ st.write(st.session_state['questions'][question_index])
292
+ col1, col2 = st.columns([3, 1])
293
+ with col2:
294
+ if st.button("Next", key="next_question"):
295
+ if question_index + 1 < len(st.session_state['questions']):
296
+ st.session_state['question_index'] += 1
297
+ else:
298
+ st.session_state['question_index'] = 0 # Loop back to first question
299
+ st.success("You have reached the end of the questions.")
300
  progress_data["questions_solved"][question_type] += num_questions
301
 
302
  st.header("🗣️ Provide Feedback")
 
336
  </div>
337
  """, unsafe_allow_html=True)
338
 
339
+