Spaces:
Sleeping
Sleeping
Initial project setup with multi-URL API
Browse files- app.py +8 -8
- process_interview.py +16 -2
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import tempfile
|
|
| 8 |
import gradio as gr
|
| 9 |
from process_interview import process_interview
|
| 10 |
from typing import Tuple, Optional, List, Dict
|
| 11 |
-
from concurrent.futures import ThreadPoolExecutor
|
| 12 |
|
| 13 |
# Setup logging
|
| 14 |
logging.basicConfig(
|
|
@@ -134,14 +134,15 @@ def analyze_multiple_audios(file_paths_or_urls: List[str]) -> Tuple[str, str, Li
|
|
| 134 |
|
| 135 |
combined_summary = "\n\n---\n\n".join(all_summaries)
|
| 136 |
# Ensure the combined_json_list is a valid JSON array string
|
| 137 |
-
combined_json_list = "[\n" + ",\n".join(all_json_data) + "\n]"
|
|
|
|
| 138 |
return combined_summary, combined_json_list, all_pdf_paths
|
| 139 |
|
| 140 |
|
| 141 |
# Gradio interface
|
| 142 |
-
with gr.Blocks(title="Interview Analysis System", theme=gr.themes.Soft()) as demo:
|
| 143 |
gr.Markdown("""
|
| 144 |
-
# ๐ค
|
| 145 |
Provide multiple audio file URLs or upload multiple audio files to analyze speaker performance.
|
| 146 |
Supported formats: WAV, MP3, M4A, FLAC (max 100MB per file).
|
| 147 |
""")
|
|
@@ -151,14 +152,13 @@ with gr.Blocks(title="Interview Analysis System", theme=gr.themes.Soft()) as dem
|
|
| 151 |
health_status = gr.Textbox(label="System Status", value=check_health(), interactive=False)
|
| 152 |
audio_inputs = gr.File(
|
| 153 |
label="Provide Audio URLs or Upload Files (Multiple allowed)",
|
| 154 |
-
type="filepath",
|
| 155 |
-
file_count="multiple" #
|
| 156 |
)
|
| 157 |
submit_btn = gr.Button("Start Analysis", variant="primary")
|
| 158 |
|
| 159 |
with gr.Column():
|
| 160 |
-
output_summary = gr.Textbox(label="Combined Analysis Summary", interactive=False,
|
| 161 |
-
lines=10) # Adjusted lines
|
| 162 |
output_json = gr.Textbox(label="Detailed Analysis (JSON Array)", interactive=False, lines=20)
|
| 163 |
pdf_outputs = gr.File(label="Download All Reports", type="filepath", file_count="multiple")
|
| 164 |
|
|
|
|
| 8 |
import gradio as gr
|
| 9 |
from process_interview import process_interview
|
| 10 |
from typing import Tuple, Optional, List, Dict
|
| 11 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 12 |
|
| 13 |
# Setup logging
|
| 14 |
logging.basicConfig(
|
|
|
|
| 134 |
|
| 135 |
combined_summary = "\n\n---\n\n".join(all_summaries)
|
| 136 |
# Ensure the combined_json_list is a valid JSON array string
|
| 137 |
+
combined_json_list = "[\n" + ",\n".join(all_json_data) + "\n]" # ุชู
ุชุตุญูุญ ุฎุทุฃ ุงูู f-string ููุง
|
| 138 |
+
|
| 139 |
return combined_summary, combined_json_list, all_pdf_paths
|
| 140 |
|
| 141 |
|
| 142 |
# Gradio interface
|
| 143 |
+
with gr.Blocks(title="EvalBot Interview Analysis System", theme=gr.themes.Soft()) as demo:
|
| 144 |
gr.Markdown("""
|
| 145 |
+
# ๐ค EvalBot: Automated Interview Analysis System
|
| 146 |
Provide multiple audio file URLs or upload multiple audio files to analyze speaker performance.
|
| 147 |
Supported formats: WAV, MP3, M4A, FLAC (max 100MB per file).
|
| 148 |
""")
|
|
|
|
| 152 |
health_status = gr.Textbox(label="System Status", value=check_health(), interactive=False)
|
| 153 |
audio_inputs = gr.File(
|
| 154 |
label="Provide Audio URLs or Upload Files (Multiple allowed)",
|
| 155 |
+
type="filepath", # ูุฐุง ูุณู
ุญ ุจู URLs
|
| 156 |
+
file_count="multiple" # ุงูุณู
ุงุญ ุจุฃูุซุฑ ู
ู URL/ู
ูู
|
| 157 |
)
|
| 158 |
submit_btn = gr.Button("Start Analysis", variant="primary")
|
| 159 |
|
| 160 |
with gr.Column():
|
| 161 |
+
output_summary = gr.Textbox(label="Combined Analysis Summary", interactive=False, lines=10)
|
|
|
|
| 162 |
output_json = gr.Textbox(label="Detailed Analysis (JSON Array)", interactive=False, lines=20)
|
| 163 |
pdf_outputs = gr.File(label="Download All Reports", type="filepath", file_count="multiple")
|
| 164 |
|
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
|
|
@@ -768,6 +768,20 @@ def create_pdf_report(analysis_data: Dict, output_path: str, gemini_report_text:
|
|
| 768 |
story.append(table)
|
| 769 |
story.append(Spacer(1, 0.2 * inch))
|
| 770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 771 |
# Detailed Interpretation from Gemini (if present)
|
| 772 |
if 'Voice Analysis Insights' in sections:
|
| 773 |
story.append(Paragraph("Detailed Interpretation:", h3))
|
|
|
|
| 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
|
|
|
|
| 768 |
story.append(table)
|
| 769 |
story.append(Spacer(1, 0.2 * inch))
|
| 770 |
|
| 771 |
+
# --- Charts ---
|
| 772 |
+
story.append(Paragraph("Score Visualization:", h3)) # Original placeholder for charts
|
| 773 |
+
chart_path = os.path.join(OUTPUT_DIR, f"anxiety_confidence_{uuid.uuid4().hex[:8]}.png")
|
| 774 |
+
generate_anxiety_confidence_chart(voice_analysis['composite_scores'], chart_path)
|
| 775 |
+
try:
|
| 776 |
+
if os.path.exists(chart_path):
|
| 777 |
+
img = Image(chart_path, width=3.5*inch, height=2.0*inch)
|
| 778 |
+
story.append(img)
|
| 779 |
+
story.append(Spacer(1, 0.1 * inch))
|
| 780 |
+
os.remove(chart_path)
|
| 781 |
+
except Exception as img_e:
|
| 782 |
+
logger.warning(f"Could not add chart image to PDF: {img_e}")
|
| 783 |
+
# --- End Charts ---
|
| 784 |
+
|
| 785 |
# Detailed Interpretation from Gemini (if present)
|
| 786 |
if 'Voice Analysis Insights' in sections:
|
| 787 |
story.append(Paragraph("Detailed Interpretation:", h3))
|