File size: 1,711 Bytes
512f4e6
 
c5d0aa5
 
 
512f4e6
c5d0aa5
512f4e6
 
 
c5d0aa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: Text Summarizer
emoji: πŸ“
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
---

# Text Summarizer πŸ“

Paste an article, email, or notes β€” **or drop in a URL** β€” and get a faithful TL;DR
plus key points, streamed live. Pick the depth: **Brief**, **Standard**, or **Detailed**.

> Project **#2** of my *"30 AI Projects in 15 Days"* build-in-public challenge.

![demo](demo.png)

## What it does
- **Summarize text or a link** β€” paste raw text, or give it a URL and it fetches +
  extracts the article for you.
- **Three depths** β€” a 2–3 sentence TL;DR, a paragraph + key bullets, or a detailed
  breakdown that preserves names/numbers/dates.
- **Faithful** β€” instructed to never add facts or opinions not in the source.
- **Live streaming** output with a one-click **Copy**.

## What it demonstrates
- **Prompt engineering** β€” length/format control via a parameterized system prompt.
- **Retrieval from the web** — server-side fetch + HTML→text extraction (BeautifulSoup).
- **Streaming UX** (Server-Sent Events) and a clean, responsive single-file UI.
- **Backend-agnostic** β€” Claude API in the cloud, or a local Ollama model. Same code.

## Run locally
```bash
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...      # or set OLLAMA_URL / OLLAMA_MODEL
python app.py                            # http://127.0.0.1:8500
```

## Deploy (always-on)
Ships with a `Dockerfile` β€” works on **Hugging Face Spaces**, Render, Railway, or Fly.io.
Set `ANTHROPIC_API_KEY` (+ optional `ANTHROPIC_MODEL=claude-haiku-4-5`) as a secret.

---
Built by **Robert Lucyk** Β· [GritAI Solutions](https://gritai.solutions) Β· part of the 30-in-15 challenge.