Spaces:
Running on Zero
Running on Zero
|
Download README.md from Interhuman/inter2-audio-playground: direct link, hf CLI and curl.
- Browser
- Download file 4.62 kB
-
https://huggingface.co/spaces/Interhuman/inter2-audio-playground/resolve/main/README.md
- Command line
-
hf download hf://spaces/Interhuman/inter2-audio-playground/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Interhuman/inter2-audio-playground/resolve/main/README.md
4.62 kB
| title: Inter-2-Audio Playground | |
| emoji: 🎙️ | |
| colorFrom: indigo | |
| colorTo: pink | |
| sdk: gradio | |
| sdk_version: 6.19.0 | |
| python_version: "3.12" | |
| app_file: app.py | |
| pinned: false | |
| license: cc-by-nc-4.0 | |
| # Inter-2 Audio Playground | |
| Try Inter-2 Audio, Interhuman AI's model for how something is said: emotion, engagement, | |
| social signals and vocal delivery, read from the voice. | |
| Upload or record a speech clip, pick a task, and press **Analyze**. The model hears the | |
| first 30 seconds of each clip. | |
| ## Tasks | |
| | Task | What it returns | JSON schema on by default | | |
| |---|---|---| | |
| | **Emotion** | one primary emotion: angry, disgusted, fearful, happy, neutral, sad or surprised, with a confidence and evidence | no | | |
| | **Combined** | engagement status (engaged, neutral, disengaged); social signals (Hesitation, Agreement, Uncertainty, Frustration, Interest, Confidence), each with a level and rationale; the primary emotion; and the vocal delivery (Normal, Crying, Laughing, Mumbling, Shouting, Singing, Whispering) | yes | | |
| Both prompts are editable. **Constrain the answer to the task's JSON schema** forces valid | |
| JSON with only the listed labels; the Emotion answer's confidence is then limited to quarters | |
| and its evidence left empty, and rationales are capped at 300 characters. Leave it off to read | |
| the model's own wording. Decoding is greedy unless you raise the temperature under **Advanced**. | |
| ## API | |
| Every run of the UI is also available as the `/generate` endpoint. The footer's | |
| **Use via API** link shows the auto-generated reference. From Python: | |
| ```python | |
| from gradio_client import Client, handle_file | |
| client = Client("Interhuman/inter2-audio-playground", token="hf_...") # your Hugging Face token | |
| summary_html, parsed_json, raw_output = client.predict( | |
| handle_file("clip.wav"), # audio file or URL; the first 30 s are used | |
| "", # system prompt | |
| PROMPT, # user prompt (see prompts/ or the UI) | |
| True, # audio before text | |
| False, # constrain to the task's JSON schema | |
| 768, 0.0, 1.0, 1.0, # max new tokens, temperature (0 = greedy), top-p, repetition penalty | |
| "Emotion", # task: "Emotion" or "Combined"; picks the schema when constrained | |
| api_name="/generate", | |
| ) | |
| ``` | |
| `parsed_json` is the model's answer as a JSON string (empty if it could not be parsed) and | |
| `raw_output` is the text exactly as generated. | |
| ### Running a folder of clips | |
| `examples/run_inter2_audio.py` sends the same prompts as the UI and writes one JSON line per clip: | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf download Interhuman/inter2-audio-playground --repo-type space --local-dir inter2-audio-playground | |
| cd inter2-audio-playground | |
| python -m venv .venv && source .venv/bin/activate # a fresh environment: the client needs a recent | |
| pip install gradio_client huggingface_hub # huggingface_hub, which older transformers installs reject | |
| HF_TOKEN=hf_... python examples/run_inter2_audio.py --task Combined --output combined.jsonl path/to/clips/ | |
| ``` | |
| Pass audio files and/or folders (searched recursively). `--constrain` / `--no-constrain` | |
| overrides the task's default. Re-running with the same `--output` skips clips already done. | |
| ### Running VocalAffectBench | |
| `examples/run_vab_bench.py` runs [VocalAffectBench](https://huggingface.co/datasets/besimple-ai/vocal-affect-bench) | |
| (280 clips, 7 emotions) through the API, from the same folder and environment as above: | |
| ```bash | |
| HF_TOKEN=hf_... python examples/run_vab_bench.py --output vab.jsonl | |
| ``` | |
| It downloads the benchmark at a pinned revision, sends each clip with the Emotion prompt and | |
| the JSON schema on (`--no-constrain` lets the model write freely), writes one JSON line per clip | |
| (clip id, gold emotion, prediction, raw output) and prints the accuracy overall and per emotion. | |
| `--limit 5` is a quick check (the clips are sorted by emotion, so it is not a sample). A full | |
| run takes roughly 10 minutes of GPU time; if your quota runs out, re-run the same command later | |
| and it continues where it stopped. | |
| ## Notes | |
| - The Space runs on ZeroGPU: each caller's GPU time counts against their own daily Hugging Face | |
| quota (anonymous callers get the least, so use a token), so a long batch may need to be | |
| resumed the next day. | |
| - The Space runs on Hugging Face infrastructure in the US. | |
| ## License | |
| The contents of this Space (code, prompts and documentation) are released under | |
| [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) by Interhuman AI. This covers the files | |
| in this repository only; the Inter-2 Audio model is not distributed here. | |