Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -141,6 +141,7 @@ CRITICAL RULES:
|
|
| 141 |
2. Separate the prompt context. Do NOT penalize or critique the user for constraints that were mentioned in the [INTERVIEW QUESTION].
|
| 142 |
3. You MUST generate an Example Answer at the very end. Keep it extremely short.
|
| 143 |
4. If the candidate's answer is very short, vague, or a variation of "I don't know", you MUST give a Grade of 1/10 and explicitly state they failed to provide an answer in the Cons.
|
|
|
|
| 144 |
|
| 145 |
GRADING SCALE (follow this strictly):
|
| 146 |
- 9-10: The answer is correct, demonstrates clear understanding, and covers the key points. It does NOT need to be perfect or exhaustive. A real interviewer would be impressed.
|
|
@@ -150,6 +151,11 @@ GRADING SCALE (follow this strictly):
|
|
| 150 |
|
| 151 |
IMPORTANT: Only list a Con if it is a genuine mistake or a significant missing concept. Do NOT list "nice-to-have" extras or alternative approaches as Cons. If the answer is strong, give it a 9 or 10.
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
You MUST output exactly this format and nothing else:
|
| 154 |
Grade: [1-10]/10
|
| 155 |
Pros:
|
|
@@ -169,6 +175,26 @@ Example Answer:
|
|
| 169 |
outputs = generator(messages, max_new_tokens=400, temperature=0.15, do_sample=True)
|
| 170 |
raw_feedback = outputs[0]['generated_text'][-1]['content']
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
score_html = create_circular_progress(raw_feedback)
|
| 173 |
clean_feedback = re.sub(r'Grade:.*?\n', '', raw_feedback).strip()
|
| 174 |
|
|
|
|
| 141 |
2. Separate the prompt context. Do NOT penalize or critique the user for constraints that were mentioned in the [INTERVIEW QUESTION].
|
| 142 |
3. You MUST generate an Example Answer at the very end. Keep it extremely short.
|
| 143 |
4. If the candidate's answer is very short, vague, or a variation of "I don't know", you MUST give a Grade of 1/10 and explicitly state they failed to provide an answer in the Cons.
|
| 144 |
+
5. A concise answer is NOT a bad answer. Judge by correctness and relevance, NOT by length.
|
| 145 |
|
| 146 |
GRADING SCALE (follow this strictly):
|
| 147 |
- 9-10: The answer is correct, demonstrates clear understanding, and covers the key points. It does NOT need to be perfect or exhaustive. A real interviewer would be impressed.
|
|
|
|
| 151 |
|
| 152 |
IMPORTANT: Only list a Con if it is a genuine mistake or a significant missing concept. Do NOT list "nice-to-have" extras or alternative approaches as Cons. If the answer is strong, give it a 9 or 10.
|
| 153 |
|
| 154 |
+
GRADING EXAMPLES:
|
| 155 |
+
- Question: "How would you secure a REST API?" Answer: "I'd use HTTPS, JWT authentication, input validation, and rate limiting." -> Grade: 9/10 (concise but covers all key points)
|
| 156 |
+
- Question: "How would you secure a REST API?" Answer: "I'd add authentication and maybe some encryption." -> Grade: 5/10 (too vague, missing specifics)
|
| 157 |
+
- Question: "How would you secure a REST API?" Answer: "I'm not really sure, probably a firewall." -> Grade: 2/10 (shows lack of understanding)
|
| 158 |
+
|
| 159 |
You MUST output exactly this format and nothing else:
|
| 160 |
Grade: [1-10]/10
|
| 161 |
Pros:
|
|
|
|
| 175 |
outputs = generator(messages, max_new_tokens=400, temperature=0.15, do_sample=True)
|
| 176 |
raw_feedback = outputs[0]['generated_text'][-1]['content']
|
| 177 |
|
| 178 |
+
# Safety net: prevent unreasonably low grades for real answers
|
| 179 |
+
match = re.search(r'Grade:\s*(\d+)', raw_feedback)
|
| 180 |
+
if match:
|
| 181 |
+
model_score = int(match.group(1))
|
| 182 |
+
word_count = len(candidate_answer.split())
|
| 183 |
+
|
| 184 |
+
# If the answer has real substance, enforce a minimum floor
|
| 185 |
+
if word_count >= 40:
|
| 186 |
+
min_grade = 4
|
| 187 |
+
elif word_count >= 20:
|
| 188 |
+
min_grade = 3
|
| 189 |
+
elif word_count >= 8:
|
| 190 |
+
min_grade = 2
|
| 191 |
+
else:
|
| 192 |
+
min_grade = 1
|
| 193 |
+
|
| 194 |
+
if model_score < min_grade:
|
| 195 |
+
adjusted_score = min_grade
|
| 196 |
+
raw_feedback = re.sub(r'Grade:\s*\d+', f'Grade: {adjusted_score}', raw_feedback)
|
| 197 |
+
|
| 198 |
score_html = create_circular_progress(raw_feedback)
|
| 199 |
clean_feedback = re.sub(r'Grade:.*?\n', '', raw_feedback).strip()
|
| 200 |
|