Update app.py
Browse files66 unmodified lines67686970717273747576777879808182838485707172737475767778798081828889909192939495969798991008384858687888990919293103104105106107108109110111112113114115116117118949596979899100101102103104105106107472 unmodified lines58058158259758358459958558658758891 unmodified lines68068168269769869970068368468568668768866 unmodified lines# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββPROMPT_TEMPLATES = { "simple": ( "You are a call-center conversation analyst for a medical clinic. From the call recording, provide a brief summary:" "- Purpose of the call (appointment / results / complaint / billing / other)." "- Patient intent and expectations." "- Outcome (booked / call-back / routed / unresolved)." "- Next steps (owner and when)." "- Patient emotion (1β5) and agent tone (1β5)." "- Alerts: urgency/risks/privacy.
" "Keep it short (6β8 lines). End with a line: βService quality rating: X/5β and one sentence explaining the rating." """You are a call-center conversation analyst for a medical clinic. From the call recording, provide a brief summary:- Purpose of the call (appointment / results / complaint / billing / other).- Patient intent and expectations.- Outcome (booked / call-back / routed / unresolved).- Next steps (owner and when).- Patient emotion (1β5) and agent tone (1β5).- Alerts: urgency/risks/privacy.
Keep it short (6β8 lines). End with a line: βService quality rating: X/5β and one sentence explaining the rating.""" ), "medium": ( "Act as a senior service analyst. Analyze the call using this structure:" "1) Quick overview: reason for the call, intent, key facts, urgency (low/medium/high)." "2) Call flow (2β4 bullets): what was asked/answered, where friction occurred." "3) Outcomes & tasks: concrete next actions for clinic/patient with timeframes." "4) Emotions & empathy: patient mood; agent empathy (0β5)." "5) Procedural compliance: identity verification, disclosure of recording (if stated), no off-protocol medical advice, data accuracy." "6) Quality rating (0β100) using rubric: greeting, verification, accuracy, empathy, issue resolution (each 0β20)." """Act as a senior service analyst. Analyze the call using this structure:1) Quick overview: reason for the call, intent, key facts, urgency (low/medium/high).2) Call flow (2β4 bullets): what was asked/answered, where friction occurred.3) Outcomes & tasks: concrete next actions for clinic/patient with timeframes.4) Emotions & empathy: patient mood; agent empathy (0β5).5) Procedural compliance: identity verification, disclosure of recording (if stated), no off-protocol medical advice, data accuracy.6) Quality rating (0β100) using rubric: greeting, verification, accuracy, empathy, issue resolution (each 0β20).""" ), "detailed": ( "You are a quality & operations analyst. Provide an in-depth analysis:" "A) Segmentation: split the call into stages with approximate timestamps (if available) and roles (Patient/Agent)." "B) Structured data for booking: full name (if stated), date of birth, phone, symptoms/complaints (list), onset/duration, possible pain level 0β10 (if mentioned), required specialist/service, preferred time windows, constraints." "C) Triage & risks: class (routine/urgent/emergency), red flags, whether immediate escalation is needed." "D) Compliance audit: identity/privacy checks, recording disclosure, consent to data processing, booking policies." "E) Conversation metrics: talk ratio (agent/patient), interruptions, long pauses, notable keywords." "F) Coaching for the agent: 3β5 concrete improvements with sample phrasing.
" "Deliver: (1) A short patient-chart summary (2β3 sentences). (2) A task table with columns: priority, owner, due." """You are a quality & operations analyst. Provide an in-depth analysis:A) Segmentation: split the call into stages with approximate timestamps (if available) and roles (Patient/Agent).B) Structured data for booking: full name (if stated), date of birth, phone, symptoms/complaints (list), onset/duration, possible pain level 0β10 (if mentioned), required specialist/service, preferred time windows, constraints.C) Triage & risks: class (routine/urgent/emergency), red flags, whether immediate escalation is needed.D) Compliance audit: identity/privacy checks, recording disclosure, consent to data processing, booking policies.E) Conversation metrics: talk ratio (agent/patient), interruptions, long pauses, notable keywords.F) Coaching for the agent: 3β5 concrete improvements with sample phrasing.
Deliver: (1) A short patient-chart summary (2β3 sentences). (2) A task table with columns: priority, owner, due.""" ),}
472 unmodified lines # Upload + generate try: uploaded_file = client.files.upload(file=mp3_path) merged = f"[SYSTEM INSTRUCTION: {sys_inst}] merged = f"""[SYSTEM INSTRUCTION: {sys_inst}]
{prompt}"{prompt}""" resp = client.models.generate_content( model=model_name, contents=[uploaded_file, merged],91 unmodified lineswith gr.Blocks(title="Vochi CRM Call Logs (Gradio)") as demo: gr.Markdown( """ # Vochi CRM β MP3 β AI analysis *Fetch daily calls, play/download MP3, and analyze the call with an AI model.* """# Vochi CRM β MP3 β AI analysis*Fetch daily calls, play/download MP3, and analyze the call with an AI model.*""" )
# Auth state (False by default)app.py+36-51