diff --git a/README.md b/README.md index 0447cad..e152d6c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,72 @@ # Transcription -Historical document transcription system. +Historical document transcription system for family-history documents. -## Prompt Artifacts +The app lets you upload a document image/PDF, queues a background transcription job, and then shows job status and results in a web UI. + +## What the app does + +- Upload document files (`.jpg`, `.jpeg`, `.png`, `.tif`, `.tiff`, `.pdf`) +- Persist document + job records in SQLite +- Process jobs in a background worker (`queued -> processing -> transcribed/failed`) +- Store transcript text (or failure detail) +- Show status and results in the NiceGUI interface + +## Quick start + +### 1) Install dependencies + +```bash +uv sync +``` + +### 2) Configure environment + +Create a `.env` file in the project root (minimum required setting shown): + +```env +OPENROUTER_API_KEY=your_openrouter_api_key +``` + +Optional settings (defaults shown): + +```env +DATABASE_URL=sqlite:///./transcription.db +UPLOAD_DIR=./uploads +PROMPT_DIR=./prompts +``` + +### 3) Run the app + +```bash +uv run uvicorn transcription.app:create_app --factory --reload +``` + +### 4) Open in browser + +- GUI: [http://[IP_ADDRESS]:8000/ui](http://[IP_ADDRESS]:8000/ui) +- Health check: [http://[IP_ADDRESS]:8000/healthz](http://[IP_ADDRESS]:8000/healthz) + +## How to navigate the GUI + +- **Upload page** (`/ui`) + - Select a supported file to upload. + - The app creates a queued transcription job. + - Use the **View jobs** link to inspect progress. + +- **Jobs page** (`/ui/jobs`) + - See all jobs and their status. + - Use **Refresh** to reload current states. + - Open a specific job to see details. + +- **Job detail page** (`/ui/jobs/{job_id}`) + - Shows job metadata and status. + - Displays transcript text when successful. + - Displays failure detail when transcription fails. + +## Prompt artifacts Prompt files are stored in `prompts/` and loaded from `PROMPT_DIR` (default: `./prompts`). -The canonical MVP prompt is `prompts/transcribe_document.md`. + +The canonical MVP prompt is: +- `prompts/transcribe_document.md` diff --git a/src/transcription/ui/upload_page.py b/src/transcription/ui/upload_page.py index 3e11b22..c4933a9 100644 --- a/src/transcription/ui/upload_page.py +++ b/src/transcription/ui/upload_page.py @@ -36,12 +36,12 @@ def register_page() -> None: state = UploadPageState() status_label = ui.label("Upload a document to start transcription.") - def on_upload(event: UploadEventArguments) -> None: + async def on_upload(event: UploadEventArguments) -> None: state.loading = True status_label.text = "Uploading..." try: - payload = event.content.read() - result = submit_upload(filename=event.name, file_bytes=payload) + payload = await event.file.read() + result = submit_upload(filename=event.file.name, file_bytes=payload) state.message = f"Created job {result.job_id}" status_label.text = state.message ui.notify(state.message, type="positive") @@ -59,4 +59,4 @@ def register_page() -> None: ).props(f"accept={accepted_upload_types()}") with ui.row(): - ui.link("View jobs", "/ui/jobs") + ui.link("View jobs", "/jobs") diff --git a/uploads/f2984991-e861-4db3-8612-2da1a8ba23d2_Book Two - page 03.jpg b/uploads/f2984991-e861-4db3-8612-2da1a8ba23d2_Book Two - page 03.jpg new file mode 100644 index 0000000..e0db646 Binary files /dev/null and b/uploads/f2984991-e861-4db3-8612-2da1a8ba23d2_Book Two - page 03.jpg differ