Spaces:
Sleeping
Sleeping
Initial project setup with multi-URL API
Browse files- process_interview.py +6 -7
process_interview.py
CHANGED
|
@@ -23,8 +23,8 @@ from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, Tabl
|
|
| 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 |
-
from reportlab.platypus import Image # ุชู
ุชูุนููู
|
| 28 |
# --- End Imports for enhanced PDF ---
|
| 29 |
from transformers import AutoTokenizer, AutoModel
|
| 30 |
import spacy
|
|
@@ -488,8 +488,8 @@ def generate_voice_interpretation(analysis: Dict) -> str:
|
|
| 488 |
return "\n".join(interpretation_lines)
|
| 489 |
|
| 490 |
|
| 491 |
-
# --- Chart Generation Function ---
|
| 492 |
-
#
|
| 493 |
# def generate_anxiety_confidence_chart(composite_scores: Dict, chart_path: str):
|
| 494 |
# pass # Placeholder if function is called but not defined
|
| 495 |
|
|
@@ -758,15 +758,14 @@ def create_pdf_report(analysis_data: Dict, output_path: str, gemini_report_text:
|
|
| 758 |
story.append(Spacer(1, 0.2 * inch))
|
| 759 |
|
| 760 |
# --- Charts ---
|
| 761 |
-
story.append(Paragraph("Score Visualization:", h3))
|
| 762 |
chart_path = os.path.join(OUTPUT_DIR, f"anxiety_confidence_{uuid.uuid4().hex[:8]}.png")
|
| 763 |
# --- FIX: ensure matplotlib and Image are imported and generate_anxiety_confidence_chart is callable ---
|
| 764 |
try:
|
| 765 |
# This function call requires matplotlib and Image to be properly imported and generate_anxiety_confidence_chart to be defined.
|
| 766 |
# If you want charts, make sure you have 'matplotlib' in requirements.txt.
|
| 767 |
-
# If you explicitly removed charts, ensure generate_anxiety_confidence_chart is replaced with a dummy or removed entirely.
|
| 768 |
# For this response, I am assuming you DO want charts, as per your question.
|
| 769 |
-
#
|
| 770 |
generate_anxiety_confidence_chart(voice_analysis['composite_scores'], chart_path)
|
| 771 |
if os.path.exists(chart_path):
|
| 772 |
img = Image(chart_path, width=3.5 * inch, height=2.0 * inch)
|
|
|
|
| 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 # ุชู
ุชูุนููู ููู charts
|
| 27 |
+
from reportlab.platypus import Image # ุชู
ุชูุนููู ููู charts
|
| 28 |
# --- End Imports for enhanced PDF ---
|
| 29 |
from transformers import AutoTokenizer, AutoModel
|
| 30 |
import spacy
|
|
|
|
| 488 |
return "\n".join(interpretation_lines)
|
| 489 |
|
| 490 |
|
| 491 |
+
# --- Chart Generation Function (REMOVED) ---
|
| 492 |
+
# This function is no longer included in this final version to avoid matplotlib/Image dependencies.
|
| 493 |
# def generate_anxiety_confidence_chart(composite_scores: Dict, chart_path: str):
|
| 494 |
# pass # Placeholder if function is called but not defined
|
| 495 |
|
|
|
|
| 758 |
story.append(Spacer(1, 0.2 * inch))
|
| 759 |
|
| 760 |
# --- Charts ---
|
| 761 |
+
story.append(Paragraph("Score Visualization:", h3)) # Original placeholder for charts
|
| 762 |
chart_path = os.path.join(OUTPUT_DIR, f"anxiety_confidence_{uuid.uuid4().hex[:8]}.png")
|
| 763 |
# --- FIX: ensure matplotlib and Image are imported and generate_anxiety_confidence_chart is callable ---
|
| 764 |
try:
|
| 765 |
# This function call requires matplotlib and Image to be properly imported and generate_anxiety_confidence_chart to be defined.
|
| 766 |
# If you want charts, make sure you have 'matplotlib' in requirements.txt.
|
|
|
|
| 767 |
# For this response, I am assuming you DO want charts, as per your question.
|
| 768 |
+
# The function definition is below, it will be added.
|
| 769 |
generate_anxiety_confidence_chart(voice_analysis['composite_scores'], chart_path)
|
| 770 |
if os.path.exists(chart_path):
|
| 771 |
img = Image(chart_path, width=3.5 * inch, height=2.0 * inch)
|