Spaces:
Sleeping
Sleeping
File size: 2,923 Bytes
de4cd1f de2a93c de4cd1f de2a93c de4cd1f de2a93c 5406f45 2573f9b 61ff229 32907e2 61ff229 32907e2 5406f45 61ff229 | 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 | ---
title: TinyModel1Space
emoji: 🤗
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
---
# TinyModel1Space
**Universal Brain chat** — natural-language routing, a **small generative instruct model** (default in code: **SmolLM2-360M-Instruct**, override with **`HORIZON2_MODEL`**), **TinyModel1** encoder (**HyperlinksSpace/TinyModel1**), **FAQ hybrid RAG**, **SQLite memory**, optional **Google web search**, and **embedded prompt signals** (one-turn reply shape from long natural wording — see in-app **Testing embedded prompt signals**). See the [model card](https://huggingface.co/HyperlinksSpace/TinyModel1) for classifier weights.
| Capability | Notes |
| --- | --- |
| **Generation** | Chat + composed answers from the causal instruct LM (quality/size depends on **`HORIZON2_MODEL`** and CPU/GPU). |
| **Encoder** | 4-way **AG News–style** labels; **embeddings** for FAQ retrieval, **`/similarity`**, **`/nearest`**. |
| **FAQ RAG** | Bundled corpus; toggle injection from chat; grounding phrases in `/help`. |
| **Memory** | Scoped SQLite notes; use *Start a new private session* / *Switch to scope …* on shared demos. |
| **Routing** | JSON router for summarize / reformulate / grounded / retrieve / **web_search** / classify / similarity / embedding / nearest / memory / status. |
| **Web** | Requires **`GOOGLE_CSE_API_KEY`** + **`GOOGLE_CSE_CX`**; optional **auto-web** (disable with **`NO_AUTO_WEB`**). |
| **NL + embedded** | Short **session control** phrases + long-message **`prompt_signals:`** style overlays (see Gradio copy under the chat). |
- **App URL:** [https://hyperlinksspace-tinymodel1space.hf.space](https://hyperlinksspace-tinymodel1space.hf.space)
- **Source:** [https://github.com/HyperlinksSpace/TinyModel](https://github.com/HyperlinksSpace/TinyModel)
### Secrets (recommended)
- `HF_TOKEN` — read token so Hub model downloads are reliable (same as classic classifier Space).
- `GOOGLE_CSE_API_KEY` — Google Cloud API key restricted to **Custom Search API** (enables `/web` and smart-route **web search** in chat).
### Optional environment variables
- `HORIZON2_MODEL` — Hugging Face id for the **generative** instruct model (default in code: SmolLM2-360M-Instruct if unset in image).
- `GOOGLE_CSE_CX` — Programmable Search Engine id (`cx` from the [PSE control panel](https://programmablesearchengine.google.com/controlpanel/all)); required together with `GOOGLE_CSE_API_KEY` for web search.
- `GOOGLE_CSE_NUM` — results per request, 1–10 (default 5).
- `GOOGLE_CSE_SAFE` — optional safe-search level for Google `cse.list` (e.g. `off`, `active`).
- `NO_AUTO_WEB` — set to `1` / `true` / `on` to disable **automatic** chat→web upgrades (router + `/web` unchanged).
### Note
First CPU start can take several minutes (downloads + two models). For faster UX, enable a GPU Space or a smaller `HORIZON2_MODEL`.
|