Skip to main content

websum

CI Python PyPI License: MIT

Summarize web pages and YouTube videos with pluggable LLM backends. Ships with first-class support for Ollama (local) and OpenAI, plus an optional Gradio web UI.

Installation

# Library + CLI, with Ollama backend
pip install 'websum[ollama]'

# With OpenAI backend
pip install 'websum[openai]'

# With the Gradio web UI
pip install 'websum[ui,ollama]'

# Everything
pip install 'websum[all]'

Using uv:

uv add 'websum[ollama]'

Quickstart

Library

from websum import Summarizer, OllamaBackend

s = Summarizer(backend=OllamaBackend(model="llama3:instruct"))
print(s.summarize("https://cobanov.dev/haftalik-bulten/hafta-13"))
print(s.summarize("https://www.youtube.com/watch?v=4pOpQwiUVXc"))
print(s.translate("Hello world", target_language="Turkish"))

Swap the backend without touching anything else:

from websum import Summarizer, OpenAIBackend

s = Summarizer(backend=OpenAIBackend(model="gpt-4o-mini"))

CLI

# Summarize a web page or YouTube URL (auto-detected)
websum summarize https://example.com

# Use OpenAI instead of Ollama
websum summarize https://example.com --backend openai --model gpt-4o-mini

# Translate
websum translate "Hello world" --target-language Turkish

# Launch the Gradio UI
websum ui --port 7860

Run websum --help for the full command reference.

API overview

Object Purpose
Summarizer High-level API. summarize(url), summarize_web(url), summarize_youtube(url), translate(text).
SummarizerConfig Chunking and language settings.
OllamaBackend, OpenAIBackend Built-in backends. Frozen dataclasses with .build().
LLMBackend (Protocol) Implement this to plug in any backend.
BackendRegistry Map string names to backend classes (used by the CLI).

All public names are re-exported from the top-level websum package and listed in __all__.

Custom backends

from dataclasses import dataclass
from websum import LLMBackend, Summarizer

@dataclass
class MyBackend:
    def build(self):
        from langchain_anthropic import ChatAnthropic
        return ChatAnthropic(model="claude-3-5-sonnet-latest")

assert isinstance(MyBackend(), LLMBackend)  # Protocol check
s = Summarizer(backend=MyBackend())

Docker

docker build -t websum .
docker run -p 7860:7860 websum

# Run when ollama is on the host
docker run --network host -p 7860:7860 websum

The image starts websum ui by default.

Migration from 0.1.x

The 0.1.x scripts under app/ (summarizer.py, translator.py, yt_summarizer.py, webui.py) are gone. Everything moved into the websum package with a typed, importable API.

Before After
python app/summarizer.py -u URL websum summarize URL
python app/webui.py websum ui
from summarizer import setup_summarization_chain from websum import Summarizer
Hardcoded ChatOllama OllamaBackend / OpenAIBackend / custom LLMBackend
pip install -r requirements.txt pip install 'websum[ollama]'

Development

git clone https://github.com/cobanov/websum
cd websum
uv sync --all-extras
uv run pre-commit install
uv run pytest
uv run ruff check .
uv run mypy src/websum

See CONTRIBUTING.md for the full guide.

License

MIT. See LICENSE.

Release files for websum 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for websum 0.2.0
File Size Uploaded
websum-0.2.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for websum 0.2.0
File Interpreter ABI Platform
websum-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / websum-0.2.0.tar.gz

Download URL websum-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
df527a9553c1f37012f85678fc3bfc89dbe3c7b6d6e60bbcc710eedb3b5c2b20
BLAKE2b-256 checksum
How to use checksums
688af7245642df724d08d4b584de7757da00a2a511aaaefe2a971f2e5d76d61f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2026.

Transparency log

Release files / websum-0.2.0-py3-none-any.whl

Download URL websum-0.2.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46c23197d69a2ee457039d51575874b5171b2b8f12a187ae56f4ba024363cc7d
BLAKE2b-256 checksum
How to use checksums
f303ff42ba931b2deedf031b381c43a37cd9d14c6b7617dc5ab43c9a09458404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page