File size: 3,005 Bytes
cfb37bf 8dcf777 cfb37bf 8dcf777 cfb37bf e4a5b87 eacda18 e4a5b87 ac22361 e4a5b87 |
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
---
title: Htrflow Mcp
emoji: 🔥
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
tags:
- mcp-server-track
- htrflow
- htr
- ocr
- api
pinned: false
license: apache-2.0
short_description: Image to text, alto- or page-xml
---
Video showcase:
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/60a4e677917119d38f6bbff8/tMp-t2pV3t3HABW0YLbMy.mp4"></video>
## MCP tooling
- htr_text: Extract plain text from handwritten documents
Parameters: image_path (string), document_type (string, default: "letter_swedish"), custom_settings (optional JSON string)
Returns: Extracted text as string
- htrflow_file: Process HTR and return formatted files
Parameters: image_path (string), document_type (string), output_format (string, default: "alto"), custom_settings (optional JSON), server_name (string)
Returns: Downloadable file in specified format
Supported formats: txt, alto, page, json
- htrflow_visualizer: Visualize HTR results on original image
Parameters: image_path (string), htr_document_path (string), server_name (string)
Returns: Visualization image with text regions highlighted

Claude Desktop
```json
{
"mcpServers": {
"htrflow": {
"command": "npx",
"args": [
"mcp-remote",
"https://[YOUR-USERNAME].hf.space/gradio_api/mcp/sse",
"--transport",
"sse-only"
]
}
}
}
```
## Usage Examples
- Can you extract the text from this handwritten Swedish letter? [upload image]
- Process this handwritten document and return the results in ALTO XML format for archival purposes.
- Show me the HTR results overlaid on the original image so I can see how accurate the text detection was.
### Standard Letter Processing
Segmentation: Detect text lines using YOLO
Text Recognition: Extract text using TrOCR
Line Ordering: Organize text in reading order
### Spread Processing
Region Segmentation: Detect page regions
Line Segmentation: Detect text lines within regions
Text Recognition: Extract text using TrOCR
Reading Order: Handle marginalia and two-page layout
Custom Settings
You can provide custom pipeline settings as JSON:
```json
{
"steps": [
{
"step": "Segmentation",
"settings": {
"model": "yolo",
"model_settings": {
"model": "Riksarkivet/yolov9-lines-within-regions-1"
},
"generation_settings": {"batch_size": 8}
}
},
{
"step": "TextRecognition",
"settings": {
"model": "TrOCR",
"model_settings": {
"model": "microsoft/trocr-base-handwritten"
},
"generation_settings": {"batch_size": 16}
}
}
]
}
```
Not enough time but would also integrate the iiif part aswell:
https://github.com/AI-Riksarkivet/oxenstierna
https://huggingface.co/collections/Riksarkivet/mcps-68447208f9eddd623a83fbc9
|