--- title: REFRAME emoji: ๐Ÿง  colorFrom: purple colorTo: indigo sdk: gradio app_file: app.py pinned: false license: gemma tags: - build-small-hackathon - track:backyard - sponsor:modal - sponsor:cohere - achievement:offgrid - achievement:welltuned - achievement:llama --- # REFRAME โ€” a live CBT studio **Reframe your thinking.** A live cognitive restructuring studio โ€” talk through an unhelpful thought (**by voice or text**) and watch it turn into a fairer, kinder one, live. The chat is a **Gemma 4 12B** model **fine-tuned on ~42,000 therapy conversations** (QLoRA on **Modal** ยท H100), running locally via **llama.cpp**; your voice is transcribed by **Cohere Transcribe**. Small models, fully on-device โ€” no cloud APIs. A Thought Card builds the cognitive-restructuring record in real time (distortion โ†’ evidence โ†’ your balanced reframe), saved to a deck with a pattern tracker. **Track:** Backyard AI โ€” a real problem (rumination / unhelpful thinking), honestly fit to the small-model constraint. ## How it works 1. **Speak** a thought โ†’ **Cohere Transcribe** turns it into text. 2. The **fine-tuned Gemma** reflects it back and asks Socratic questions. 3. A **Thought Card** tags the distortion, gathers evidence, and you write the **balanced thought** โ€” it's yours, so it sticks. 4. Cards save to your **Deck**; the **Patterns** tab shows what recurs over time. ## Tech (all โ‰ค 32B, runs locally) - **Chat:** `google/gemma-4-12B-it` (12B), **fine-tuned (QLoRA) on mental-health counseling, empathetic-dialogue & crisis-response data** โ†’ published on the Hub. - **Training:** **Modal**, single **NVIDIA H100 80GB** (unsloth ยท peft ยท trl ยท bitsandbytes). - **Inference:** merged **GGUF Q4_K_M**, run by **llama.cpp** (Ollama locally / llama-cpp-python on the Space). - **Voice:** **Cohere Transcribe** (`CohereLabs/cohere-transcribe-03-2026`) โ€” on **ZeroGPU** here, Intel Arc XPU locally. - **UI:** custom Gradio theme; private by design (no cloud APIs). ## Badges - โœ… **Well-Tuned** โ€” fine-tuned, published model - โœ… **Llama Champion** โ€” llama.cpp runtime - โœ… **Off the Grid** โ€” no cloud APIs; all inference local/self-hosted - *(Off-Brand: verify it qualifies โ€” needs custom UI beyond default Gradio)* ## Links - ๐ŸŽฅ **Demo video:** https://youtu.be/OjWORvLAwq8 - ๐Ÿ“ฃ **Social post:** https://x.com/v_r_droids/status/2066664719822282796 - ๐Ÿค– **Model:** https://huggingface.co/emailvenky/gemma4-mentalhealthbuddy-v1 ## Note A supportive tool, not a replacement for professional care. If a message signals crisis, REFRAME surfaces helplines immediately. โ€” Created with ๐Ÿ in Canada