File size: 2,212 Bytes
af9809a
aa00509
af9809a
 
 
 
 
 
 
9e85ee8
fe8178a
 
 
af9809a
 
aa00509
af9809a
aa00509
 
 
af9809a
 
 
 
 
aa00509
af9809a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa00509
 
 
af9809a
aa00509
af9809a
 
 
 
 
 
 
 
 
 
aa00509
 
af9809a
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
---
title: TemperCheck
emoji: 😀
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: "6.18.0"
app_file: app.py
pinned: false
short_description: How short a temper does this profile look to have?
tags:
  - track:backyard
  - achievement:offgrid
---

# 😀 TemperCheck

Upload a social-media profile (or a screenshot of one) and TemperCheck gives a
playful read on **how short-tempered / difficult that person looks to deal with**
β€” a 0–100 score, a punchy verdict, and the "signals" it picked up on.

Built for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon/)
using a small **Gemma 4 E4B** vision-language model (~8B params, well under the
32B limit).

> ⚠️ **It's a party game.** TemperCheck reads vibes in a picture for laughs. It is
> not a real personality test and makes no factual claim about any real person.

## How it runs

On this **Space** it runs the `transformers` backend on **ZeroGPU** β€” the model
is `google/gemma-4-E4B-it`, loaded on `cuda` at startup and run inside a
`@spaces.GPU` function. (The Space needs an `HF_TOKEN` secret with access to the
gated Gemma repo.) The backend is selected automatically from the `SPACE_ID` env,
so there's nothing to configure.

Locally you can run the UI against a local Ollama instead (`uv run app.py`, opens
http://localhost:7140), but note Gemma 4 vision is currently unreliable in Ollama,
so the local path is for UI work β€” real verdicts come from the Space.

## Configuration (env vars)

| Var | Default | Purpose |
|-----|---------|---------|
| `TEMPER_BACKEND` | `transformers` on a Space, else `ollama` | force a backend |
| `TEMPER_HF_MODEL` | `google/gemma-4-E4B-it` | transformers model id |
| `TEMPER_OLLAMA_MODEL` | `huihui_ai/gemma-4-abliterated:e4b-q8_0` | local Ollama model id |
| `OLLAMA_HOST` | `http://127.0.0.1:11434` | local Ollama server |
| `TEMPER_PORT` | `7140` | local Gradio port |

## Tests

```bash
uv run pytest
```

## Project layout

- `app.py` β€” Gradio UI.
- `tempercheck/inference.py` β€” backend abstraction (Ollama ↔ transformers).
- `tempercheck/prompt.py` β€” system prompt + defensive JSON parsing.
- `tests/test_parsing.py` β€” output-parsing tests (no model needed).