๐ Section 06 โ HTTP Integration
While Wyoming is optimized for streaming socket communication, it also supports basic HTTP interfaces via Flask for environments where streaming is not available or needed.
๐งฉ HTTP Services Provided
Wyoming includes three HTTP servers:
| Path | File | Description |
|---|---|---|
/asr |
wyoming/http/asr_server.py |
Accepts WAV uploads and returns transcript |
/tts |
wyoming/http/tts_server.py |
Accepts text and returns audio |
/intent |
wyoming/http/intent_server.py |
Accepts text and returns structured intent |
๐งช Example: Speech-to-Text (ASR)
Endpoint: POST /asr
Content-Type: multipart/form-data
Fields:
- audio โ WAV file
- name โ ASR model name (optional)
Curl Example:
curl -F "audio=@sample.wav" http://localhost:5001/asr
Response:
{ "text": "hello world" }
๐ฃ๏ธ Example: Text-to-Speech (TTS)
Endpoint: POST /tts
Content-Type: application/json
Payload:
{ "text": "Hello!", "voice": { "language": "en" } }
Curl Example:
curl -X POST http://localhost:5002/tts \
-H "Content-Type: application/json" \
-d '{"text":"hello!"}' --output hello.wav
๐ฏ Example: Intent Recognition
Endpoint: POST /intent
Content-Type: application/json
Payload:
{ "text": "Turn off the lights" }
Response:
{
"intent": {
"name": "TurnOff",
"entities": [ { "name": "device", "value": "lights" } ]
}
}
โ๏ธ Running the Servers
Each HTTP server is a standalone Python script and uses Flask. You can run them directly:
python3 wyoming/http/asr_server.py
python3 wyoming/http/tts_server.py
python3 wyoming/http/intent_server.py
๐ฆ Deployment Notes
- Not optimized for large-scale concurrent users.
- Recommended for local or single-user systems.
- Ideal for Home Assistant Add-ons or debugging Wyoming services.
๐ง Tip
These HTTP services are thin wrappers around Wyoming socket clients.
They convert HTTP input to Wyoming Events and forward to backend services.
You can modify or extend them to fit your infrastructure.