Shorten HF short_description
Browse files
README.md
CHANGED
|
@@ -6,87 +6,5 @@ colorTo: blue
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
-
short_description:
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# Whisper ASR Space
|
| 13 |
-
|
| 14 |
-
FastAPI service for **Hololens / Unity / clients**: `POST /audio` with the same format as local `ASR/src/web_realtime.py`.....
|
| 15 |
-
|
| 16 |
-
Default **Hub model** in code: [`Thedeezat/ASR-Hearing-Impaired`](https://huggingface.co/Thedeezat/ASR-Hearing-Impaired). You can override with Space variable **`MODEL_ID`**.
|
| 17 |
-
|
| 18 |
-
## Your checklist (what you do)
|
| 19 |
-
|
| 20 |
-
### 1. Model on the Hub (already done if you use that repo)
|
| 21 |
-
|
| 22 |
-
If you use another checkpoint: create a **model repo** and upload everything from `ASR/models/whisper_finetuned/` (`config.json`, tokenizer files, weights, etc.; use **Git LFS** for large files).
|
| 23 |
-
|
| 24 |
-
### 2. Create this Space on Hugging Face
|
| 25 |
-
|
| 26 |
-
1. Create a **new Space** → choose **Docker** (not Gradio).
|
| 27 |
-
2. Name it (e.g. `YOUR_USERNAME/whisper-asr-space`).
|
| 28 |
-
3. Clone the empty Space locally, then **copy into it** the files from **this folder** in your grad-project repo:
|
| 29 |
-
- `Dockerfile`
|
| 30 |
-
- `main.py`
|
| 31 |
-
- `requirements.txt`
|
| 32 |
-
- replace the auto-generated `README.md` **metadata** at the top with the YAML block in this file (title, `sdk: docker`, etc.)
|
| 33 |
-
|
| 34 |
-
Or: push this `ASR/ASR-Hearing-Impaired-API/` folder contents to the Space repo’s `main` branch.
|
| 35 |
-
|
| 36 |
-
```bash
|
| 37 |
-
cd ASR/hf_space
|
| 38 |
-
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE
|
| 39 |
-
cp Dockerfile main.py requirements.txt YOUR_SPACE/
|
| 40 |
-
# Copy README.md from here (full file) into YOUR_SPACE/README.md
|
| 41 |
-
cd YOUR_SPACE
|
| 42 |
-
git add -A && git commit -m "Add ASR API" && git push
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
### 3. Private or gated model — **HF_TOKEN** (required)
|
| 46 |
-
|
| 47 |
-
401 / “Repository Not Found” usually means the Space is not authenticated for **`Thedeezat/ASR-Hearing-Impaired`**.
|
| 48 |
-
|
| 49 |
-
1. Open the Space → **Settings** → **Variables and secrets**.
|
| 50 |
-
2. Under **Repository secrets** (not “Variables”), add:
|
| 51 |
-
- **Name:** `HF_TOKEN` (exactly; the app reads this and `HUGGING_FACE_HUB_TOKEN`).
|
| 52 |
-
- **Value:** a [fine-grained](https://huggingface.co/docs/hub/security-tokens#fine-grained-access-tokens) or **classic** token with **Read** access to model repo `Thedeezat/ASR-Hearing-Impaired`.
|
| 53 |
-
3. **Redeploy** the Space (new commit or “Factory reboot”) after saving the secret.
|
| 54 |
-
4. Do **not** paste the token in code, chat, or README. If it was exposed, **revoke** it on your [token settings](https://huggingface.co/settings/tokens) and create a new one.
|
| 55 |
-
|
| 56 |
-
The API passes your token only to `from_pretrained` (it does **not** call `huggingface_hub.login()`), so startup avoids extra `whoami` calls that can trigger **HTTP 429** on Hugging Face.
|
| 57 |
-
|
| 58 |
-
Optional: **`MODEL_ID`** variable only if you use another Hub repo than the default.
|
| 59 |
-
|
| 60 |
-
### 3b. Speed / latency (optional — matches local `web_realtime`)
|
| 61 |
-
|
| 62 |
-
These **Space variables** (or Docker `-e`) tune inference to match the fast local defaults:
|
| 63 |
-
|
| 64 |
-
| Variable | Default | Meaning |
|
| 65 |
-
|----------|---------|--------|
|
| 66 |
-
| `ASR_WHISPER_NUM_BEAMS` | `1` | Greedy decode (fastest). Use `2` for slightly better quality, slower. |
|
| 67 |
-
| `ASR_WHISPER_MAX_NEW_TOKENS` | `256` | Shorter decoder cap → faster responses. |
|
| 68 |
-
| `ASR_MIN_RMS` | `0.009` | Drop very quiet chunks (noise) before the model. |
|
| 69 |
-
|
| 70 |
-
Generation also uses Whisper **no_speech** / **compression_ratio** thresholds (same idea as `ASR/src/whisper_asr.py`) to reduce silence hallucinations, plus trailing-silence trim and light repetition cleanup on the server.
|
| 71 |
-
|
| 72 |
-
### 4. Public URL for your HoloLens app
|
| 73 |
-
|
| 74 |
-
After the Space builds (**Building** → **Running**), your API base is:
|
| 75 |
-
|
| 76 |
-
`https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space`
|
| 77 |
-
|
| 78 |
-
Examples:
|
| 79 |
-
|
| 80 |
-
- `GET https://...hf.space/` — service info
|
| 81 |
-
- `GET https://...hf.space/health` — health
|
| 82 |
-
- `POST https://...hf.space/audio` — body = float32 PCM (same as `web_realtime`), header `X-Sample-Rate: 16000`
|
| 83 |
-
|
| 84 |
-
**Note:** Free Spaces **sleep after inactivity**; the first request after sleep can take a long time (cold start). Upgrade to paid hardware if you need always-hot GPU/CPU.
|
| 85 |
-
|
| 86 |
-
## Local smoke test
|
| 87 |
-
|
| 88 |
-
```bash
|
| 89 |
-
docker build -t whisper-asr .
|
| 90 |
-
docker run -e MODEL_ID=Thedeezat/ASR-Hearing-Impaired -p 7860:7860 whisper-asr
|
| 91 |
-
curl http://127.0.0.1:7860/health
|
| 92 |
-
```
|
|
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
+
short_description: Whisper ASR HTTP API
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|