farbodpya commited on
Commit
2f7a699
·
verified ·
1 Parent(s): 66c87f4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -17
README.md CHANGED
@@ -1,35 +1,30 @@
1
  ---
2
  license: apache-2.0
3
  language:
4
- - fa
5
  pipeline_tag: image-to-text
6
  widget:
7
- - src: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/papers/attention.png
8
- example_title: "Persian OCR"
9
  ---
10
 
11
- ---
12
  # Persian-OCR
13
 
14
- Persian-OCR is a deep learning model for **Optical Character Recognition (OCR)**
15
- designed specifically for Persian text. The model uses a **CNN + Transformer architecture**
16
- trained with CTC loss to extract text from images.
17
 
18
  ## Files
19
 
20
- - `pytorch_model.bin` : PyTorch model weights
21
- - `vocab.json` : Character vocabulary
22
- - `config.json` : Model configuration
23
 
24
  ## Installation
25
 
26
  ```bash
27
- !pip install torch torchvision huggingface_hub
28
-
29
 
30
 
31
- ## Usage Example
32
-
33
 
34
  import torch
35
  import json
@@ -72,9 +67,13 @@ weights_path = hf_hub_download("farbodpya/Persian-OCR", "pytorch_model.bin")
72
  model = CNN_Transformer_OCR(num_classes=len(idx_to_char)+1)
73
  model.load_state_dict(torch.load(weights_path, map_location="cpu"))
74
  model.eval()
 
75
  # -----------------------------
76
- # 9️⃣ Example usage
77
  # -----------------------------
78
- img_path = "/content/Screenshot 2025-09-19 145016.png"
79
  text = ocr_page(img_path, model, idx_to_char, visualize=True)
80
- print("\n=== Final OCR Page ===\n", text)
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  language:
4
+ - fa
5
  pipeline_tag: image-to-text
6
  widget:
7
+ - src: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/papers/attention.png
8
+ example_title: "Persian OCR"
9
  ---
10
 
 
11
  # Persian-OCR
12
 
13
+ **Persian-OCR** is a deep learning model for **Optical Character Recognition (OCR)**, designed specifically for Persian text.
14
+ The model uses a **CNN + Transformer architecture** trained with **CTC loss** to extract text from images.
 
15
 
16
  ## Files
17
 
18
+ - `pytorch_model.bin` : PyTorch model weights
19
+ - `vocab.json` : Character vocabulary
20
+ - `config.json` : Model configuration
21
 
22
  ## Installation
23
 
24
  ```bash
25
+ pip install torch torchvision huggingface_hub
 
26
 
27
 
 
 
28
 
29
  import torch
30
  import json
 
67
  model = CNN_Transformer_OCR(num_classes=len(idx_to_char)+1)
68
  model.load_state_dict(torch.load(weights_path, map_location="cpu"))
69
  model.eval()
70
+
71
  # -----------------------------
72
+ # 5️⃣ Example usage
73
  # -----------------------------
74
+ img_path = "sample.png"
75
  text = ocr_page(img_path, model, idx_to_char, visualize=True)
76
+ print("\n=== Final OCR Page ===\n", text)
77
+
78
+
79
+