norhan12 commited on
Commit
131ec5b
·
1 Parent(s): 0ffccd7

Add system dependencies for matplotlib image saving

Browse files
Files changed (3) hide show
  1. Dockerfile +7 -1
  2. process_interview.py +6 -4
  3. requirements.txt +2 -1
Dockerfile CHANGED
@@ -7,9 +7,15 @@ RUN apt-get update && apt-get install -y \
7
  sox \
8
  curl \
9
  git-lfs \
 
 
 
 
 
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # 2. Create non-root user (moved up for better permissions)
13
  RUN useradd -m appuser
14
  # 3. Create directory structure (with proper ownership from the start)
15
  RUN mkdir -p \
 
7
  sox \
8
  curl \
9
  git-lfs \
10
+ # --- FIX: New system dependencies for matplotlib image generation ---
11
+ pkg-config \
12
+ libfreetype6-dev \
13
+ libpng-dev \
14
+ g++ \
15
+ # --- End FIX ---
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # 2. Create non-root user
19
  RUN useradd -m appuser
20
  # 3. Create directory structure (with proper ownership from the start)
21
  RUN mkdir -p \
process_interview.py CHANGED
@@ -19,12 +19,14 @@ from typing import Dict, List, Tuple
19
  import logging
20
  # --- Imports for enhanced PDF ---
21
  from reportlab.lib.pagesizes import letter
22
- from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, ListFlowable, \
23
- ListItem
24
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
25
  from reportlab.lib.units import inch
26
  from reportlab.lib import colors
27
  import matplotlib.pyplot as plt # تم تفعيله
 
 
 
28
  from reportlab.platypus import Image # تم تفعيله
29
  # --- End Imports for enhanced PDF ---
30
  from transformers import AutoTokenizer, AutoModel
@@ -154,7 +156,7 @@ def extract_prosodic_features(audio_path: str, start_ms: int, end_ms: int) -> Di
154
  except Exception as e:
155
  logger.error(f"Feature extraction failed: {str(e)}")
156
  return {
157
- 'duration': 0.0, # Return 0.0 for duration on error to prevent issues
158
  'mean_pitch': 0.0,
159
  'min_pitch': 0.0,
160
  'max_pitch': 0.0,
@@ -632,7 +634,7 @@ def generate_report(analysis_data: Dict) -> str:
632
  {voice_interpretation}
633
 
634
  **3. Content Analysis & Strengths/Areas for Development**
635
- Analyze the key themes and identify both strengths and areas for development in the interviewee's responses.
636
  Key responses from interviewee (for context):
637
  {chr(10).join(interviewee_responses)}
638
 
 
19
  import logging
20
  # --- Imports for enhanced PDF ---
21
  from reportlab.lib.pagesizes import letter
22
+ from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
 
23
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
24
  from reportlab.lib.units import inch
25
  from reportlab.lib import colors
26
  import matplotlib.pyplot as plt # تم تفعيله
27
+ import matplotlib # إضافة import matplotlib
28
+
29
+ matplotlib.use('Agg') # --- FIX: تحديد backend لـ matplotlib ---
30
  from reportlab.platypus import Image # تم تفعيله
31
  # --- End Imports for enhanced PDF ---
32
  from transformers import AutoTokenizer, AutoModel
 
156
  except Exception as e:
157
  logger.error(f"Feature extraction failed: {str(e)}")
158
  return {
159
+ 'duration': 0.0,
160
  'mean_pitch': 0.0,
161
  'min_pitch': 0.0,
162
  'max_pitch': 0.0,
 
634
  {voice_interpretation}
635
 
636
  **3. Content Analysis & Strengths/Areas for Development**
637
+ Analyze the key themes and identify both strengths and and areas for development in the interviewee's responses.
638
  Key responses from interviewee (for context):
639
  {chr(10).join(interviewee_responses)}
640
 
requirements.txt CHANGED
@@ -67,4 +67,5 @@ gradio
67
  hf_transfer
68
  matplotlib
69
  seaborn
70
- reportlab
 
 
67
  hf_transfer
68
  matplotlib
69
  seaborn
70
+ reportlab
71
+ Pillow