File size: 2,658 Bytes
baa0948
4ae4ae8
 
 
 
baa0948
 
 
 
4ae4ae8
 
8ca6d0a
 
 
 
 
 
baa0948
 
4ae4ae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71d455f
 
4ae4ae8
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
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