Update README.md
Browse files
README.md
CHANGED
|
@@ -17,4 +17,97 @@ license: apache-2.0
|
|
| 17 |
short_description: Image to text, alto- or page-xml
|
| 18 |
---
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
short_description: Image to text, alto- or page-xml
|
| 18 |
---
|
| 19 |
|
| 20 |
+
Video showcase:
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
## MCP tooling
|
| 25 |
+
|
| 26 |
+
- htr_text: Extract plain text from handwritten documents
|
| 27 |
+
|
| 28 |
+
Parameters: image_path (string), document_type (string, default: "letter_swedish"), custom_settings (optional JSON string)
|
| 29 |
+
Returns: Extracted text as string
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
- htrflow_file: Process HTR and return formatted files
|
| 33 |
+
|
| 34 |
+
Parameters: image_path (string), document_type (string), output_format (string, default: "alto"), custom_settings (optional JSON), server_name (string)
|
| 35 |
+
Returns: Downloadable file in specified format
|
| 36 |
+
Supported formats: txt, alto, page, json
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
- htrflow_visualizer: Visualize HTR results on original image
|
| 40 |
+
|
| 41 |
+
Parameters: image_path (string), htr_document_path (string), server_name (string)
|
| 42 |
+
Returns: Visualization image with text regions highlighted
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
Claude Desktop
|
| 47 |
+
|
| 48 |
+
```json
|
| 49 |
+
{
|
| 50 |
+
"mcpServers": {
|
| 51 |
+
"htrflow": {
|
| 52 |
+
"command": "npx",
|
| 53 |
+
"args": [
|
| 54 |
+
"mcp-remote",
|
| 55 |
+
"https://[YOUR-USERNAME].hf.space/gradio_api/mcp/sse",
|
| 56 |
+
"--transport",
|
| 57 |
+
"sse-only"
|
| 58 |
+
]
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Usage Examples
|
| 65 |
+
- Can you extract the text from this handwritten Swedish letter? [upload image]
|
| 66 |
+
- Process this handwritten document and return the results in ALTO XML format for archival purposes.
|
| 67 |
+
- Show me the HTR results overlaid on the original image so I can see how accurate the text detection was.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
### Standard Letter Processing
|
| 71 |
+
Segmentation: Detect text lines using YOLO
|
| 72 |
+
Text Recognition: Extract text using TrOCR
|
| 73 |
+
Line Ordering: Organize text in reading order
|
| 74 |
+
|
| 75 |
+
### Spread Processing
|
| 76 |
+
Region Segmentation: Detect page regions
|
| 77 |
+
Line Segmentation: Detect text lines within regions
|
| 78 |
+
Text Recognition: Extract text using TrOCR
|
| 79 |
+
Reading Order: Handle marginalia and two-page layout
|
| 80 |
+
|
| 81 |
+
Custom Settings
|
| 82 |
+
You can provide custom pipeline settings as JSON:
|
| 83 |
+
|
| 84 |
+
```json
|
| 85 |
+
{
|
| 86 |
+
"steps": [
|
| 87 |
+
{
|
| 88 |
+
"step": "Segmentation",
|
| 89 |
+
"settings": {
|
| 90 |
+
"model": "yolo",
|
| 91 |
+
"model_settings": {
|
| 92 |
+
"model": "Riksarkivet/yolov9-lines-within-regions-1"
|
| 93 |
+
},
|
| 94 |
+
"generation_settings": {"batch_size": 8}
|
| 95 |
+
}
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"step": "TextRecognition",
|
| 99 |
+
"settings": {
|
| 100 |
+
"model": "TrOCR",
|
| 101 |
+
"model_settings": {
|
| 102 |
+
"model": "microsoft/trocr-base-handwritten"
|
| 103 |
+
},
|
| 104 |
+
"generation_settings": {"batch_size": 16}
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
]
|
| 108 |
+
}
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
Not enough time but would also integrate the iiif part aswell:
|
| 112 |
+
https://github.com/AI-Riksarkivet/oxenstierna
|
| 113 |
+
https://huggingface.co/collections/Riksarkivet/mcps-68447208f9eddd623a83fbc9
|