https://github.com/cospectrum/echo-hub
Natural language processing service
https://github.com/cospectrum/echo-hub
Last synced: 12 months ago
JSON representation
Natural language processing service
- Host: GitHub
- URL: https://github.com/cospectrum/echo-hub
- Owner: cospectrum
- License: apache-2.0
- Created: 2025-02-23T19:59:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-03T10:22:43.000Z (over 1 year ago)
- Last Synced: 2025-03-03T11:31:15.668Z (over 1 year ago)
- Language: Python
- Size: 207 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# echo-hub
[![github]](https://github.com/cospectrum/echo-hub)
[![ci]](https://github.com/cospectrum/echo-hub/actions)
[github]: https://img.shields.io/badge/github-cospectrum/echo--hub-8da0cb?logo=github
[ci]: https://github.com/cospectrum/echo-hub/workflows/ci/badge.svg
Natural language processing service.
## Getting started
### start
```sh
docker compose up -d --wait
```
### test
```sh
export NLP_API_URL=http://localhost:6001
uv run coverage run -m pytest .
```
### down
```sh
docker compose down -v
```
You may need to delete some volumes manually.
## Packages
## nlp-api
The [nlp-api](./packages/nlp-api/) is a configurable API that can operate in multiple modes,
including `http_mode`, `queue_mode`, or both.
In `http_mode`, the nlp-api maintains the `SpeechToText` model in its state and runs the model
directly via the POST `/speech_to_text` endpoint.
In `queue_mode`, the nlp-api provides a POST route `/speech_to_text/task`.
This route saves the audio file to `S3`, sends the task (`audio_key`) to `rabbitmq`, and returns the `audio_key` to the client.
The task is later processed by the `stt-worker`, and the result can be checked using the GET `/speech_to_text/task` route in the nlp-api,
which simply verifies whether the result exists in the database.
## stt-worker
The [stt-worker](./packages/stt-worker/) is a long-running process (or processes) that consumes tasks (`audio_key`s) from `rabbitmq`.
It retrieves the corresponding audio file from `S3`, runs the `speech_to_text` model, and saves the `result` to the database.