Update process_interview.py
Browse files- process_interview.py +4 -5
process_interview.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
```python
|
| 2 |
import os
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
|
@@ -915,7 +914,7 @@ def calculate_acceptance_probability(segments: Dict) -> float:
|
|
| 915 |
)
|
| 916 |
|
| 917 |
min_possible_score = 0.0
|
| 918 |
-
max_possible_score = sum(abs(w) for w in weights.values())
|
| 919 |
normalized_score = (raw_score - min_possible_score) / (max_possible_score - min_possible_score) if max_possible_score > 0 else 0.5
|
| 920 |
acceptance_score = max(0.0, min(1.0, normalized_score))
|
| 921 |
return float(round(acceptance_score * 100, 2))
|
|
@@ -959,7 +958,7 @@ def generate_report(content: Dict, segments: List[Dict]) -> str:
|
|
| 959 |
u.get('prosodic_features', {}).get('duration', 0)
|
| 960 |
for u in segments
|
| 961 |
)
|
| 962 |
-
speaker_turns = len([u[' for u in segments if u.get('text', '')].strip()])
|
| 963 |
speakers = list(set(u['speaker_id'] for u in segments if u.get('speaker_id', '')))
|
| 964 |
|
| 965 |
prompt = f"""
|
|
@@ -998,7 +997,7 @@ def create_pdf_document(text: str, content: Dict, output_path: str) -> bool:
|
|
| 998 |
bool: True if PDF created successfully, False otherwise.
|
| 999 |
"""
|
| 1000 |
try:
|
| 1001 |
-
doc = SimpleDocTemplate(output_path, pagesize=
|
| 1002 |
styles = getSampleStyleSheet()
|
| 1003 |
h1_style = ParagraphStyle(
|
| 1004 |
name='Heading1',
|
|
@@ -1041,7 +1040,7 @@ def create_pdf_document(text: str, content: Dict, output_path: str) -> bool:
|
|
| 1041 |
story.append(Paragraph(f"Date: {time.strftime('%Y-%m-%d')}", body_style))
|
| 1042 |
story.append(Spacer(1, 0.3 * inch))
|
| 1043 |
|
| 1044 |
-
acceptance_prob = content.get('acceptance_probability', 0.0)
|
| 1045 |
if acceptance_prob > 0:
|
| 1046 |
story.append(Paragraph("Candidate Evaluation", " h2_style))
|
| 1047 |
prob_color = 'green' if acceptance_prob >= 70 else 'orange' if acceptance_prob >= 40 else 'red'
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import torch
|
| 3 |
import numpy as np
|
|
|
|
| 914 |
)
|
| 915 |
|
| 916 |
min_possible_score = 0.0
|
| 917 |
+
max_possible_score = sum(abs(w) for w in weights.values())
|
| 918 |
normalized_score = (raw_score - min_possible_score) / (max_possible_score - min_possible_score) if max_possible_score > 0 else 0.5
|
| 919 |
acceptance_score = max(0.0, min(1.0, normalized_score))
|
| 920 |
return float(round(acceptance_score * 100, 2))
|
|
|
|
| 958 |
u.get('prosodic_features', {}).get('duration', 0)
|
| 959 |
for u in segments
|
| 960 |
)
|
| 961 |
+
speaker_turns = len([u[' for u in segments if u.get('text', '')'].strip()])
|
| 962 |
speakers = list(set(u['speaker_id'] for u in segments if u.get('speaker_id', '')))
|
| 963 |
|
| 964 |
prompt = f"""
|
|
|
|
| 997 |
bool: True if PDF created successfully, False otherwise.
|
| 998 |
"""
|
| 999 |
try:
|
| 1000 |
+
doc = SimpleDocTemplate(output_path, pagesize=letter)
|
| 1001 |
styles = getSampleStyleSheet()
|
| 1002 |
h1_style = ParagraphStyle(
|
| 1003 |
name='Heading1',
|
|
|
|
| 1040 |
story.append(Paragraph(f"Date: {time.strftime('%Y-%m-%d')}", body_style))
|
| 1041 |
story.append(Spacer(1, 0.3 * inch))
|
| 1042 |
|
| 1043 |
+
acceptance_prob = content.get('acceptance_probability' , 0.0)
|
| 1044 |
if acceptance_prob > 0:
|
| 1045 |
story.append(Paragraph("Candidate Evaluation", " h2_style))
|
| 1046 |
prob_color = 'green' if acceptance_prob >= 70 else 'orange' if acceptance_prob >= 40 else 'red'
|