Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,7 +87,7 @@ def get_questions(prompt, input_text, num_questions=3, max_retries=10):
|
|
| 87 |
|
| 88 |
return new_questions
|
| 89 |
|
| 90 |
-
async def generate_question_audio(question, voice="en-US-
|
| 91 |
clean_question = re.sub(r'[^A-Za-z0-9.,?! ]+', '', question)
|
| 92 |
tts = edge_tts.Communicate(text=clean_question, voice=voice)
|
| 93 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
|
@@ -168,7 +168,7 @@ for param in HR_PARAMETERS_CONFIG:
|
|
| 168 |
# SUmmary of improvement(function)
|
| 169 |
|
| 170 |
def generate_improvement_suggestions():
|
| 171 |
-
model = genai.GenerativeModel('gemini-2.0-flash
|
| 172 |
difficulty_level = st.session_state.get("difficulty_level_select", "Beginner")
|
| 173 |
level_string = difficulty_level.lower()
|
| 174 |
|
|
@@ -247,7 +247,7 @@ def generate_improvement_suggestions():
|
|
| 247 |
|
| 248 |
|
| 249 |
def evaluate_answers():
|
| 250 |
-
model = genai.GenerativeModel('gemini-2.0-flash
|
| 251 |
# difficulty_level_select is the key for the difficulty selectbox in your sidebar
|
| 252 |
difficulty_level = st.session_state.get("difficulty_level_select", "Beginner")
|
| 253 |
level_string = difficulty_level.lower()
|
|
@@ -399,41 +399,86 @@ def evaluate_answers():
|
|
| 399 |
base_assessment_criteria_qualitative_non_hr = """
|
| 400 |
For the OVERALL qualitative summary, assess responses based on:
|
| 401 |
- Conceptual Understanding (effort and relevance more than perfect accuracy for the level)
|
| 402 |
-
- Communication Clarity (
|
| 403 |
- Depth of Explanation (relative to expected level)
|
| 404 |
-
- Use of Examples (if any, and
|
| 405 |
-
- Logical Flow (
|
|
|
|
|
|
|
| 406 |
"""
|
| 407 |
per_question_scoring_guidelines_non_hr = f"""
|
| 408 |
-
For EACH question and its answer,
|
| 409 |
The candidate is at a {level_string} level.
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
-
|
| 413 |
-
-
|
| 414 |
-
-
|
| 415 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
if level_string == "beginner":
|
| 418 |
level_specific_instructions_non_hr = """
|
| 419 |
-
You are
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
- **
|
| 424 |
-
- **
|
| 425 |
-
- **
|
| 426 |
-
|
|
|
|
|
|
|
|
|
|
| 427 |
"""
|
| 428 |
elif level_string == "intermediate":
|
| 429 |
-
level_specific_instructions_non_hr = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
else: # Advanced
|
| 431 |
-
level_specific_instructions_non_hr = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
|
| 433 |
evaluation_prompt_template_non_hr = f"""
|
| 434 |
{level_specific_instructions_non_hr}
|
| 435 |
{per_question_scoring_guidelines_non_hr}
|
| 436 |
{base_assessment_criteria_qualitative_non_hr}
|
|
|
|
|
|
|
|
|
|
| 437 |
**YOUR RESPONSE MUST STRICTLY FOLLOW THIS FORMAT. PROVIDE SCORES FOR EACH QUESTION.**
|
| 438 |
Output format:
|
| 439 |
**Per-Question Scores:**
|
|
@@ -445,7 +490,9 @@ def evaluate_answers():
|
|
| 445 |
- Depth of Explanation: [Overall qualitative feedback here]
|
| 446 |
- Examples: [Overall qualitative feedback here]
|
| 447 |
- Logical Flow: [Overall qualitative feedback here]
|
|
|
|
| 448 |
[Any additional overall encouraging remarks can optionally follow here]
|
|
|
|
| 449 |
"""
|
| 450 |
candidate_responses_formatted_non_hr = "\n\n".join(
|
| 451 |
[f"Question {i+1}: {entry['question']}\nAnswer {i+1}: {str(entry.get('response', '[No response provided]'))}" for i, entry in enumerate(st.session_state["answers"])]
|
|
@@ -516,57 +563,130 @@ def evaluate_answers():
|
|
| 516 |
########################################///////////////////////////////////////////////////#########################################
|
| 517 |
# --- Prompts for Question Generation ---
|
| 518 |
BEGINNER_PROMPT = """
|
| 519 |
-
You are a friendly mock interview trainer conducting a
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
"""
|
| 535 |
|
| 536 |
INTERMEDIATE_PROMPT = """
|
| 537 |
-
You are a professional mock interviewer conducting an
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
"""
|
| 553 |
|
| 554 |
ADVANCED_PROMPT = """
|
| 555 |
-
You are a strict mock interviewer conducting an
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
"""
|
| 571 |
|
| 572 |
########################################///////////////////////////////////////////////////#########################################
|
|
@@ -722,7 +842,7 @@ if st.session_state["selected_domain"] == "Soft Skills":
|
|
| 722 |
st.warning("⚠️ Please upload a resume.")
|
| 723 |
st.stop()
|
| 724 |
prompt = f"Ask {num_qs} HR-style interview questions based on this resume: {input_text}"
|
| 725 |
-
model = genai.GenerativeModel('gemini-2.0-flash
|
| 726 |
response = model.generate_content([prompt])
|
| 727 |
questions = [q.strip("* ") for q in response.text.strip().split("\n") if q.strip()]
|
| 728 |
st.session_state["generated_questions"] = questions[:num_qs]
|
|
@@ -863,7 +983,7 @@ else:
|
|
| 863 |
st.session_state["generated_questions"] = sample(questions_from_excel, min(num_qs, len(questions_from_excel)))
|
| 864 |
else:
|
| 865 |
prompt = f"Ask {num_qs} direct and core-level {difficulty} interview questions related to {input_text}. Do not include intros or numbering."
|
| 866 |
-
model = genai.GenerativeModel('gemini-2.0-flash
|
| 867 |
response = model.generate_content([prompt, input_text])
|
| 868 |
lines = response.text.strip().split("\n")
|
| 869 |
questions = [q.strip("* ") for q in lines if q.strip()]
|
|
|
|
| 87 |
|
| 88 |
return new_questions
|
| 89 |
|
| 90 |
+
async def generate_question_audio(question, voice="en-US-JennyNeural"):
|
| 91 |
clean_question = re.sub(r'[^A-Za-z0-9.,?! ]+', '', question)
|
| 92 |
tts = edge_tts.Communicate(text=clean_question, voice=voice)
|
| 93 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
|
|
|
| 168 |
# SUmmary of improvement(function)
|
| 169 |
|
| 170 |
def generate_improvement_suggestions():
|
| 171 |
+
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 172 |
difficulty_level = st.session_state.get("difficulty_level_select", "Beginner")
|
| 173 |
level_string = difficulty_level.lower()
|
| 174 |
|
|
|
|
| 247 |
|
| 248 |
|
| 249 |
def evaluate_answers():
|
| 250 |
+
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 251 |
# difficulty_level_select is the key for the difficulty selectbox in your sidebar
|
| 252 |
difficulty_level = st.session_state.get("difficulty_level_select", "Beginner")
|
| 253 |
level_string = difficulty_level.lower()
|
|
|
|
| 399 |
base_assessment_criteria_qualitative_non_hr = """
|
| 400 |
For the OVERALL qualitative summary, assess responses based on:
|
| 401 |
- Conceptual Understanding (effort and relevance more than perfect accuracy for the level)
|
| 402 |
+
- Communication Clarity (is the idea understandable and logically stated?)
|
| 403 |
- Depth of Explanation (relative to expected level)
|
| 404 |
+
- Use of Examples (if any, and appropriate for the level)
|
| 405 |
+
- Logical Flow (basic structure or reasoning flow)
|
| 406 |
+
|
| 407 |
+
Focus on both understanding and reasoning. Responses should demonstrate thinking, not memorization.
|
| 408 |
"""
|
| 409 |
per_question_scoring_guidelines_non_hr = f"""
|
| 410 |
+
For EACH question and its answer, assign a score from 0 to 5 points.
|
| 411 |
The candidate is at a {level_string} level.
|
| 412 |
+
Use the numeric scale and notes below for calibration.
|
| 413 |
+
**Scoring Scale (per question):**
|
| 414 |
+
- **5 (Excellent / 90–100%)** → Comprehensive, accurate, and well-structured. Includes reasoning or an example. Rare and well-deserved.
|
| 415 |
+
- **4 (Good / 75–89%)** → Mostly correct, relevant, and clear. Minor conceptual gaps but good structure.
|
| 416 |
+
- **3 (Fair / 60–74%)** → Partially correct or lacks depth, but shows understanding and effort.
|
| 417 |
+
- **2 (Basic / 45–59%)** → One-line or short answer with minimal reasoning; incomplete or overly generic.
|
| 418 |
+
- **1 (Poor / 30–44%)** → Attempted but largely irrelevant or unclear.
|
| 419 |
+
- **0 (No Effort / <30%)** → Incorrect, off-topic, or explicitly “I don’t know”.
|
| 420 |
+
**Important Rules:**
|
| 421 |
+
- *One-word or one-line answers* (e.g., just definitions or keywords) must NOT score more than **2 out of 5**, regardless of correctness, because they lack reasoning and depth.
|
| 422 |
+
- Encourage clarity, structure, and explanation over memorized phrases.
|
| 423 |
"""
|
| 424 |
+
scoring_tightness_guidelines = """
|
| 425 |
+
**Scoring Calibration (Strictness Guidance):**
|
| 426 |
+
- Maintain a slightly tight scoring approach.
|
| 427 |
+
- Incomplete or short one-line answers score **below 60% (1–2 out of 5)**.
|
| 428 |
+
- Scores of **5/5 (100%)** should be **rare** — reserved for comprehensive, insightful, and well-reasoned answers.
|
| 429 |
+
- Most competent answers should fall between **3 and 4**.
|
| 430 |
+
- When unsure, choose the **lower score** to maintain scoring consistency.
|
| 431 |
+
"""
|
| 432 |
+
|
| 433 |
if level_string == "beginner":
|
| 434 |
level_specific_instructions_non_hr = """
|
| 435 |
+
You are a **supportive, understanding evaluator** for a **BEGINNER/FRESHER**.
|
| 436 |
+
Focus on clarity, effort, and attempt — not perfection.
|
| 437 |
+
Encourage learning through feedback, but ensure fair scoring.
|
| 438 |
+
**Scoring Guidelines (0–5):**
|
| 439 |
+
- **5** → Accurate, clear, well-structured, and shows strong effort and reasoning. Rare.
|
| 440 |
+
- **4** → Mostly correct, relevant, and shows basic reasoning or understanding.
|
| 441 |
+
- **3** → Partial correctness with effort; may lack completeness or flow.
|
| 442 |
+
- **1–2** → One-line or definition-only answers; minimal reasoning. (Below 60%)
|
| 443 |
+
- **0** → No effort or irrelevant response.
|
| 444 |
+
Avoid giving high scores to short, memorized, or definition-only responses.
|
| 445 |
+
Provide motivating feedback that highlights areas of improvement.
|
| 446 |
"""
|
| 447 |
elif level_string == "intermediate":
|
| 448 |
+
level_specific_instructions_non_hr = """
|
| 449 |
+
You are a **balanced and fair evaluator** for an **INTERMEDIATE** candidate.
|
| 450 |
+
Expect conceptual clarity, structured reasoning, and relevant examples.
|
| 451 |
+
Be encouraging yet objective in scoring.
|
| 452 |
+
**Scoring Guidelines (0–5):**
|
| 453 |
+
- **5** → Clear, accurate, structured response with reasoning and relevance. Rare.
|
| 454 |
+
- **4** → Mostly correct with some logical structure and explanation.
|
| 455 |
+
- **3** → Some understanding; missing clarity or key detail.
|
| 456 |
+
- **1–2** → Short, definition-like, or minimal response. (Below 60%)
|
| 457 |
+
- **0** → Irrelevant or incorrect.
|
| 458 |
+
Never assign high scores to one-line or superficial answers.
|
| 459 |
+
"""
|
| 460 |
else: # Advanced
|
| 461 |
+
level_specific_instructions_non_hr = """
|
| 462 |
+
You are a **discerning but fair evaluator** for an **ADVANCED** professional.
|
| 463 |
+
Expect precision, applied understanding, and structured reasoning.
|
| 464 |
+
Maintain fairness without excessive strictness.
|
| 465 |
+
**Scoring Guidelines (0–5):**
|
| 466 |
+
- **5** → Exceptionally comprehensive, insightful, and accurate. (Rare)
|
| 467 |
+
- **4** → Correct and well-reasoned; may lack minor nuance or application.
|
| 468 |
+
- **3** → Adequate but missing depth, structure, or examples.
|
| 469 |
+
- **1–2** → Generic, incomplete, or one-line responses without reasoning. (Below 60%)
|
| 470 |
+
- **0** → Fundamentally incorrect or irrelevant.
|
| 471 |
+
Be concise and consistent in judgment; reward depth, not brevity.
|
| 472 |
+
|
| 473 |
+
"""
|
| 474 |
|
| 475 |
evaluation_prompt_template_non_hr = f"""
|
| 476 |
{level_specific_instructions_non_hr}
|
| 477 |
{per_question_scoring_guidelines_non_hr}
|
| 478 |
{base_assessment_criteria_qualitative_non_hr}
|
| 479 |
+
{scoring_tightness_guidelines}
|
| 480 |
+
When evaluating, be supportive yet fair. Encourage clarity and effort but avoid over-rewarding shallow or memorized answers.
|
| 481 |
+
Maintain a balanced tone — neither too strict nor too lenient.
|
| 482 |
**YOUR RESPONSE MUST STRICTLY FOLLOW THIS FORMAT. PROVIDE SCORES FOR EACH QUESTION.**
|
| 483 |
Output format:
|
| 484 |
**Per-Question Scores:**
|
|
|
|
| 490 |
- Depth of Explanation: [Overall qualitative feedback here]
|
| 491 |
- Examples: [Overall qualitative feedback here]
|
| 492 |
- Logical Flow: [Overall qualitative feedback here]
|
| 493 |
+
- Final Remarks: [Brief encouraging but fair closing note]
|
| 494 |
[Any additional overall encouraging remarks can optionally follow here]
|
| 495 |
+
Provide the final tone as **professional, balanced, and confidence-building**.
|
| 496 |
"""
|
| 497 |
candidate_responses_formatted_non_hr = "\n\n".join(
|
| 498 |
[f"Question {i+1}: {entry['question']}\nAnswer {i+1}: {str(entry.get('response', '[No response provided]'))}" for i, entry in enumerate(st.session_state["answers"])]
|
|
|
|
| 563 |
########################################///////////////////////////////////////////////////#########################################
|
| 564 |
# --- Prompts for Question Generation ---
|
| 565 |
BEGINNER_PROMPT = """
|
| 566 |
+
You are a friendly mock interview trainer conducting a beginner-level spoken interview in SQL.
|
| 567 |
+
|
| 568 |
+
Candidate background:
|
| 569 |
+
{input_text}
|
| 570 |
+
|
| 571 |
+
Interview scope (MANDATORY):
|
| 572 |
+
- DBMS (RDBMS, types of RDBMS, use)
|
| 573 |
+
- SQL Clauses (SELECT, WHERE, GROUP BY, HAVING, ORDER BY)
|
| 574 |
+
- SQL Constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK)
|
| 575 |
+
- SQL Joins (INNER, LEFT, RIGHT, FULL – basics only)
|
| 576 |
+
- SQL Views
|
| 577 |
+
- SQL Commands (DDL, DML, DQL, DELETE vs TRUNCATE vs DROP)
|
| 578 |
+
|
| 579 |
+
Question Rules (STRICT):
|
| 580 |
+
1. Ask ONLY beginner-level conceptual questions.
|
| 581 |
+
2. Avoid coding syntax, queries, or SQL keywords formatting.
|
| 582 |
+
3. Use simple, spoken English—as if asking a fresher.
|
| 583 |
+
4. Each question must focus on **one clear concept**.
|
| 584 |
+
5. Questions must be **practical and real-world oriented**.
|
| 585 |
+
|
| 586 |
+
|
| 587 |
+
- DO NOT rephrase, repeat, or slightly modify any of the above.
|
| 588 |
+
- Generate **new and conceptually different questions only**.
|
| 589 |
+
|
| 590 |
+
Cross-Questioning Rule:
|
| 591 |
+
- If the candidate answers a concept (assume basic understanding),
|
| 592 |
+
ask ONE logical follow-up that tests clarity or application.
|
| 593 |
+
- Follow-up must be related but NOT repetitive.
|
| 594 |
+
|
| 595 |
+
Structure Requirement:
|
| 596 |
+
- Ask 5 questions in total:
|
| 597 |
+
• 3 primary concept questions from different SQL areas
|
| 598 |
+
• 2 follow-up cross questions based on understanding
|
| 599 |
+
|
| 600 |
+
❌ Do NOT include greetings or closing statements.
|
| 601 |
+
❌ Do NOT ask vague questions like “Explain SQL” or “What is a database”.
|
| 602 |
+
❌ Do NOT repeat topics already covered within the same session.
|
| 603 |
+
|
| 604 |
"""
|
| 605 |
|
| 606 |
INTERMEDIATE_PROMPT = """
|
| 607 |
+
You are a professional mock interviewer conducting an intermediate-level spoken interview in the domain of {selected_domain}.
|
| 608 |
+
|
| 609 |
+
Candidate background:
|
| 610 |
+
{input_text}
|
| 611 |
+
|
| 612 |
+
Interview Scope (MANDATORY):
|
| 613 |
+
- Core concepts relevant to {selected_domain}
|
| 614 |
+
- Best practices and common mistakes
|
| 615 |
+
- Real-world usage scenarios
|
| 616 |
+
- Decision-making and trade-off reasoning
|
| 617 |
+
|
| 618 |
+
Question Design Rules (STRICT):
|
| 619 |
+
1. Ask intermediate-level verbal questions that test understanding, not memory.
|
| 620 |
+
2. Questions must combine:
|
| 621 |
+
• a concept
|
| 622 |
+
• a practical situation or decision
|
| 623 |
+
3. No coding, formulas, syntax, or step-by-step instructions.
|
| 624 |
+
4. Use clear, spoken English suitable for interview conversation.
|
| 625 |
+
5. Each question must assess reasoning, explanation, or choice justification.
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
- DO NOT repeat, rephrase, paraphrase, or partially overlap with these questions.
|
| 629 |
+
- Each new question must introduce a **new angle or scenario**.
|
| 630 |
+
|
| 631 |
+
Cross-Questioning Logic:
|
| 632 |
+
- For at least 2 questions, ask a follow-up that:
|
| 633 |
+
• challenges the candidate’s reasoning
|
| 634 |
+
• explores consequences or alternatives
|
| 635 |
+
- Follow-up questions must deepen evaluation, not repeat the concept.
|
| 636 |
+
|
| 637 |
+
Structure Requirement:
|
| 638 |
+
- Ask exactly 6 questions:
|
| 639 |
+
• 4 primary scenario-based questions
|
| 640 |
+
• 2 logically connected follow-up questions
|
| 641 |
+
- Ensure questions span **different sub-topics** within {selected_domain}.
|
| 642 |
+
|
| 643 |
+
❌ Do NOT include greetings, closing statements, or filler sentences.
|
| 644 |
+
❌ Do NOT ask generic questions like “Explain” or “What is”.
|
| 645 |
+
❌ Avoid theoretical definitions unless tied to a real-world scenario.
|
| 646 |
+
|
| 647 |
"""
|
| 648 |
|
| 649 |
ADVANCED_PROMPT = """
|
| 650 |
+
You are a strict, senior-level mock interviewer conducting an advanced spoken interview in the domain of {selected_domain}.
|
| 651 |
+
|
| 652 |
+
Candidate background:
|
| 653 |
+
{input_text}
|
| 654 |
+
|
| 655 |
+
Interview Objective:
|
| 656 |
+
Evaluate deep expertise, judgment, trade-offs, and real-world decision-making ability within {selected_domain}.
|
| 657 |
+
|
| 658 |
+
Question Design Rules (VERY STRICT):
|
| 659 |
+
1. Ask advanced-level questions that assume strong foundational knowledge.
|
| 660 |
+
2. Every question must involve:
|
| 661 |
+
• a real-world scenario, constraint, or failure case
|
| 662 |
+
• a clear “why” or “how” decision explanation
|
| 663 |
+
3. No coding, formulas, or technical syntax.
|
| 664 |
+
4. Questions must demand structured, multi-point reasoning.
|
| 665 |
+
5. Each question should test impact, risk, scalability, or maintainability.
|
| 666 |
+
|
| 667 |
+
🚫 Absolute Non-Repetition Rule:
|
| 668 |
+
- The following questions have already been asked across previous sessions:
|
| 669 |
+
|
| 670 |
+
- DO NOT repeat, paraphrase, restructure, or partially overlap with these questions.
|
| 671 |
+
- Each new question must explore a **new risk, trade-off, or decision dimension**.
|
| 672 |
+
|
| 673 |
+
Advanced Cross-Examination Logic:
|
| 674 |
+
- For at least 3 questions, include a follow-up that:
|
| 675 |
+
• challenges assumptions
|
| 676 |
+
• introduces a constraint (scale, performance, data quality, security, cost)
|
| 677 |
+
• forces the candidate to defend or revise their approach
|
| 678 |
+
- Follow-ups must **escalate difficulty**, not restate the concept.
|
| 679 |
+
|
| 680 |
+
Structure Requirement:
|
| 681 |
+
- Ask exactly 7 questions total:
|
| 682 |
+
• 4 primary deep-dive scenario questions
|
| 683 |
+
• 3 targeted follow-up cross-examination questions
|
| 684 |
+
- Ensure coverage across **different high-impact areas** of {selected_domain}.
|
| 685 |
+
|
| 686 |
+
❌ Do NOT include greetings, closings, or filler language.
|
| 687 |
+
❌ Do NOT ask definition-based or descriptive questions.
|
| 688 |
+
❌ Avoid broad “What would you do?”—each question must have a specific context.
|
| 689 |
+
|
| 690 |
"""
|
| 691 |
|
| 692 |
########################################///////////////////////////////////////////////////#########################################
|
|
|
|
| 842 |
st.warning("⚠️ Please upload a resume.")
|
| 843 |
st.stop()
|
| 844 |
prompt = f"Ask {num_qs} HR-style interview questions based on this resume: {input_text}"
|
| 845 |
+
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 846 |
response = model.generate_content([prompt])
|
| 847 |
questions = [q.strip("* ") for q in response.text.strip().split("\n") if q.strip()]
|
| 848 |
st.session_state["generated_questions"] = questions[:num_qs]
|
|
|
|
| 983 |
st.session_state["generated_questions"] = sample(questions_from_excel, min(num_qs, len(questions_from_excel)))
|
| 984 |
else:
|
| 985 |
prompt = f"Ask {num_qs} direct and core-level {difficulty} interview questions related to {input_text}. Do not include intros or numbering."
|
| 986 |
+
model = genai.GenerativeModel('gemini-2.0-flash')
|
| 987 |
response = model.generate_content([prompt, input_text])
|
| 988 |
lines = response.text.strip().split("\n")
|
| 989 |
questions = [q.strip("* ") for q in lines if q.strip()]
|