Skip to content

loguntsovae/TextSummarizer

Repository files navigation

TextSummarizer

Async text summarization service built on FastAPI, Redis and WebSocket.

Tasks are submitted via an API Gateway, queued in Redis, processed asynchronously by a Worker (OpenAI or Hugging Face models), and results are streamed back to the client over WebSocket.

Architecture

Client
  ├── POST /summarize → API Gateway → Redis queue
  └── WS  /ws/{task_id} ← Worker (async result)

The gateway and worker are decoupled services: gateway enqueues, worker polls and publishes, client subscribes.

Stack

  • FastAPI — API gateway and WebSocket endpoint
  • Redis — task queue and pub/sub
  • OpenAI / Hugging Face — summarization models (configurable)
  • WebSocket — real-time result streaming
  • Docker Compose — local deployment

Quick start

cp .env.example .env           # add OPENAI_API_KEY or HF_TOKEN
docker compose up --build

Submit a task:

curl -X POST http://localhost:8000/summarize \
  -H "Content-Type: application/json" \
  -d '{"text": "Your long text here..."}'
# → {"task_id": "abc-123"}

Then connect to ws://localhost:8000/ws/abc-123 to receive the result.

Running tests

pip install -r requirements-test.txt
pytest tests/ -v

Docs

  • Architecture — design decisions, Repository pattern, Pub/Sub rationale
  • API Examples — curl, Python and JS usage examples

License

MIT

About

Text Summarizer is a microservice-based FastAPI application that uses Redis and WebSockets for real-time text summarization. Tasks are queued through an API Gateway, processed asynchronously by a Worker (using OpenAI or Hugging Face models), and updates are streamed live to the web interface.

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors