File size: 2,944 Bytes
971e3f4
 
 
 
 
 
69d1664
971e3f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: The Compounding Test
emoji: πŸ“ˆ
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false
license: mit
short_description: A diagnostic for AI investments at non-tech companies.
hardware: zero-a10g
---

# The Compounding Test

A diagnostic for AI investments at non-technology companies. Paste a
description of your AI initiative (200–5000 words); receive a scored
writeup in one of four quadrants β€” **compounder**, **one-shot win**,
**compounding the wrong thing**, or **Roman Candle**.

Framework essay: <https://www.mile-hi.ai/journal/the-berkshire-test>

## Backends

The Space supports three interchangeable model backends. The dropdown
in the UI lets you switch per-submission to compare writeup quality.

| Backend | Model (default) | Credentials | Where it runs |
|---|---|---|---|
| `anthropic` | `claude-opus-4-7` | `ANTHROPIC_API_KEY` (Space secret) | Anthropic API |
| `huggingface` | `google/gemma-2-9b-it` | none on a Space; `HF_TOKEN` locally | HF Inference Providers |
| `zerogpu` | `microsoft/Phi-4-mini-instruct` | none β€” Pro plan handles it | On-Space ZeroGPU |

**Auto-detect precedence:**

1. Explicit `MODEL_PROVIDER` env var wins.
2. On a Pro Space (zerogpu deps installed) β†’ `zerogpu`.
3. Else if `ANTHROPIC_API_KEY` is set β†’ `anthropic`.
4. Else if `HF_TOKEN` is set, or running on any Space β†’ `huggingface`.
5. Else fall through to `anthropic` (call-time error guides the user).

## Configuration

See `.env.example` for the full list of env vars. Common overrides:

```
MODEL_PROVIDER=zerogpu
ZEROGPU_MODEL_ID=google/gemma-2-9b-it     # bigger; ~30s cold start on A10
ZEROGPU_DURATION_SECONDS=120              # max GPU allocation per request
HF_MODEL_ID=meta-llama/Llama-3.3-70B-Instruct
MODEL_ID=claude-sonnet-4-6                # cheaper Anthropic fallback
```

## Local development

```bash
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt           # ~2GB with torch/transformers
cp .env.example .env                       # fill in whatever you have
python app.py                              # http://127.0.0.1:7860
```

If you only need to test the `anthropic` backend locally, you can skip
the heavy `spaces` / `torch` / `transformers` / `accelerate` lines in
`requirements.txt` β€” the app degrades gracefully (the zerogpu dropdown
option won't appear).

## Tests

```bash
pytest test_diagnose.py -v
```

31 tests covering the parser contract (15 β€” what JSON shapes the parser
accepts and rejects) and the provider routing (16 β€” auto-detection
precedence, dispatcher routing, env-driven overrides).

## Repository

Source lives in [apingali/effectiveness][repo] under
`gradio-apps/compounding-test/`. The Space is deployed from that path.
The published framework essay and four portrait articles live at
<https://www.mile-hi.ai/journal/the-berkshire-test>.

[repo]: https://github.com/apingali/effectiveness