Update README.md
Browse files
README.md
CHANGED
|
@@ -1,71 +1,72 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Tzefa
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 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 |
-
|-- Stage
|
| 37 |
-
|-- Stage
|
| 38 |
-
|-- Stage
|
| 39 |
-
|-- Stage
|
| 40 |
-
|-- Stage
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
| 50 |
-
|
|
| 51 |
-
| Binarization (
|
| 52 |
-
|
|
| 53 |
-
|
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
- [Binarization
|
| 69 |
-
- [
|
| 70 |
-
- [
|
| 71 |
-
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Tzefa
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.9.0
|
| 8 |
+
python_version: 3.11
|
| 9 |
+
app_file: app.py
|
| 10 |
+
pinned: false
|
| 11 |
+
license: cc-by-nc-3.0
|
| 12 |
+
pipeline_tag: image-to-text
|
| 13 |
+
tags:
|
| 14 |
+
- vision
|
| 15 |
+
- ocr
|
| 16 |
+
- document-processing
|
| 17 |
+
- binarization
|
| 18 |
+
- yolo
|
| 19 |
+
- trocr
|
| 20 |
+
- handwriting-recognition
|
| 21 |
+
- programming-language
|
| 22 |
+
- compiler
|
| 23 |
+
thumbnail: >-
|
| 24 |
+
https://cdn-uploads.huggingface.co/production/uploads/6645e2ce9c6ed6c615e56bf0/eTdBX9sR1-qzBuEPVWwZA.jpeg
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# Tzefa - Handwritten Code to Execution
|
| 28 |
+
|
| 29 |
+
**Tzefa** is an end-to-end system that photographs handwritten code on a whiteboard,
|
| 30 |
+
recognizes it via a custom OCR pipeline, compiles it through a custom programming language,
|
| 31 |
+
and executes it -- all from a single image upload.
|
| 32 |
+
|
| 33 |
+
## Pipeline
|
| 34 |
+
```
|
| 35 |
+
Image Upload
|
| 36 |
+
|-- Stage 1: Binarization -- HighResMAnet (mit_b5), tiled 640x640
|
| 37 |
+
|-- Stage 2: Line Segmentation -- YOLO11x-OBB, oriented bounding boxes
|
| 38 |
+
|-- Stage 3: Word Segmentation -- Morphological dilation (exactly 3 words/line)
|
| 39 |
+
|-- Stage 4: Word OCR -- Fine-tuned TrOCR
|
| 40 |
+
|-- Stage 5: Error Correction -- Edit-distance matching against Tzefa vocabulary
|
| 41 |
+
|-- Stage 6: Compilation -- Tzefa instructions -> Python code
|
| 42 |
+
'-- Stage 7: Execution -- Subprocess with 15s timeout
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Modular Design
|
| 46 |
+
All models load from their own HuggingFace repos. Push new weights to any repo
|
| 47 |
+
and this Space picks them up on next run.
|
| 48 |
+
|
| 49 |
+
| Component | Model Repo |
|
| 50 |
+
|-----------|-----------|
|
| 51 |
+
| Binarization (b3) | [WARAJA/Model](https://huggingface.co/spaces/WARAJA/Model) |
|
| 52 |
+
| Binarization (b5) | [WARAJA/b5_model](https://huggingface.co/WARAJA/b5_model) |
|
| 53 |
+
| Line Segmentation | [WARAJA/Tzefa-Line-Segmentation-YOLO](https://huggingface.co/WARAJA/Tzefa-Line-Segmentation-YOLO) |
|
| 54 |
+
| Word OCR | [WARAJA/Tzefa-Word-OCR-TrOCR](https://huggingface.co/WARAJA/Tzefa-Word-OCR-TrOCR) |
|
| 55 |
+
|
| 56 |
+
## Tzefa Language
|
| 57 |
+
Every instruction is exactly 3 tokens: `COMMAND ARG1 ARG2`
|
| 58 |
+
|
| 59 |
+
```
|
| 60 |
+
MAKEINTEGER NUMY FIVE -- create integer NUMY = 5
|
| 61 |
+
MULTIPLY RESULT BIGLY -- RESULT = RESULT * BIGLY
|
| 62 |
+
PRINTINTEGER TEMPORARY BREAK -- print TEMPORARY with newline
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Numbers are written as words (ZERO through ONEHUNDRED) to maximize OCR error correction.
|
| 66 |
+
|
| 67 |
+
## Related
|
| 68 |
+
- [Binarization Demo](https://huggingface.co/spaces/WARAJA/Tzefa-Binarization)
|
| 69 |
+
- [Binarization Dataset](https://huggingface.co/datasets/WARAJA/Tzefa-Binarization-Dataset)
|
| 70 |
+
- [Line Segmentation Dataset](https://huggingface.co/datasets/WARAJA/Tzefa-Line-Segmentation-Dataset)
|
| 71 |
+
- [Word OCR Dataset](https://huggingface.co/datasets/WARAJA/Tzefa-Word-OCR-Dataset)
|
| 72 |
+
|