Spaces:
Sleeping
Sleeping
Venkatesh Rajagopal
REFRAME: live CBT studio β fine-tuned Gemma 12B on Modal + Cohere voice (ZeroGPU)
4ae4ae8 | """Crisis detection and response.""" | |
| from __future__ import annotations | |
| import config | |
| def detect_crisis(text: str) -> bool: | |
| """Check if user message contains crisis indicators.""" | |
| text_lower = text.lower() | |
| return any(kw in text_lower for kw in config.CRISIS_KEYWORDS) | |
| def get_crisis_response() -> str: | |
| """Get the warm crisis response message.""" | |
| return ( | |
| "I hear you. What you're feeling right now matters, " | |
| "and you don't have to go through this alone." | |
| ) | |
| def get_crisis_banner_html() -> str: | |
| """Render crisis helpline banner as HTML.""" | |
| lines = [] | |
| for h in config.HELPLINES: | |
| lines.append(f"<div class='helpline'><strong>{h['name']}</strong> β {h['contact']}</div>") | |
| return f""" | |
| <div class="crisis-banner"> | |
| <div class="crisis-header">π You're not alone. Help is available:</div> | |
| {''.join(lines)} | |
| <div class="crisis-footer">I'm still here. We can keep talking, or try a grounding exercise β whatever feels right.</div> | |
| </div> | |
| """ | |