Spaces:
Sleeping
Sleeping
Update process_interview.py
Browse files- process_interview.py +13 -16
process_interview.py
CHANGED
|
@@ -491,29 +491,26 @@ def generate_voice_interpretation(analysis: Dict) -> str:
|
|
| 491 |
return "\n".join(interpretation_lines)
|
| 492 |
|
| 493 |
|
| 494 |
-
|
| 495 |
-
def generate_anxiety_confidence_chart(composite_scores: Dict, chart_path: str):
|
| 496 |
try:
|
| 497 |
labels = ['Anxiety', 'Confidence']
|
| 498 |
scores = [composite_scores.get('anxiety', 0), composite_scores.get('confidence', 0)]
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
ax.
|
| 502 |
-
ax.
|
| 503 |
-
ax.
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
# هذه الأوامر يجب أن تكون خارج الـ loop عشان يتم تنفيذها مرة واحدة بعد رسم كل العناصر
|
| 510 |
plt.tight_layout()
|
| 511 |
-
plt.savefig(
|
| 512 |
-
plt.close(fig)
|
| 513 |
except Exception as e:
|
| 514 |
logger.error(f"Error generating chart: {str(e)}")
|
| 515 |
|
| 516 |
-
|
| 517 |
# --- Acceptance Probability Calculation ---
|
| 518 |
def calculate_acceptance_probability(analysis_data: Dict) -> float:
|
| 519 |
"""
|
|
|
|
| 491 |
return "\n".join(interpretation_lines)
|
| 492 |
|
| 493 |
|
| 494 |
+
def generate_anxiety_confidence_chart(composite_scores: Dict, chart_path_or_buffer):
|
|
|
|
| 495 |
try:
|
| 496 |
labels = ['Anxiety', 'Confidence']
|
| 497 |
scores = [composite_scores.get('anxiety', 0), composite_scores.get('confidence', 0)]
|
| 498 |
+
fig, ax = plt.subplots(figsize=(5, 3))
|
| 499 |
+
bars = ax.bar(labels, scores, color=['#FF6B6B', '#4ECDC4'], edgecolor='black', width=0.6)
|
| 500 |
+
ax.set_ylabel('Score (Normalized)', fontsize=12)
|
| 501 |
+
ax.set_title('Vocal Dynamics: Anxiety vs. Confidence', fontsize=14, pad=15)
|
| 502 |
+
ax.set_ylim(0, 1.2)
|
| 503 |
+
for bar in bars:
|
| 504 |
+
height = bar.get_height()
|
| 505 |
+
ax.text(bar.get_x() + bar.get_width()/2, height + 0.05, f"{height:.2f}",
|
| 506 |
+
ha='center', color='black', fontweight='bold', fontsize=11)
|
| 507 |
+
ax.grid(True, axis='y', linestyle='--', alpha=0.7)
|
|
|
|
| 508 |
plt.tight_layout()
|
| 509 |
+
plt.savefig(chart_path_or_buffer, format='png', bbox_inches='tight', dpi=200)
|
| 510 |
+
plt.close(fig)
|
| 511 |
except Exception as e:
|
| 512 |
logger.error(f"Error generating chart: {str(e)}")
|
| 513 |
|
|
|
|
| 514 |
# --- Acceptance Probability Calculation ---
|
| 515 |
def calculate_acceptance_probability(analysis_data: Dict) -> float:
|
| 516 |
"""
|