Skip to content

Commit

Permalink
Add CRNN example to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arxyzan committed Sep 20, 2023
1 parent 8f2f486 commit ec89094
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,19 @@ print(transcripts)
- Image to Text (OCR)
```python
from hezar import Model

# OCR with TrOCR
model = Model.load("hezarai/trocr-fa-v1")
text = model.predict(["examples/assets/ocr_example.jpg"])
print(text)
texts = model.predict(["examples/assets/ocr_example.jpg"])
print(f"TrOCR Output: {texts}")

# OCR with CRNN
model = Model.load("hezarai/crnn-base-fa-64x256")
texts = model.predict("examples/assets/ocr_example.jpg")
print(f"CRNN Output: {texts}")
```
```
{'texts': [' چه میشه کرد، باید صبر کنیم']}
TrOCR Output: {'texts': [' چه میشه کرد، باید صبر کنیم']}
CRNN Output: {'texts': ['چه میشه کرد، باید صبر کنیم']}
```
We constantly keep working on adding and training new models and this section will hopefully be expanding every day ;)
### Word Embeddings
Expand Down
14 changes: 10 additions & 4 deletions docs/get_started/quick_tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ print(transcripts)
- **Image to Text (OCR)**
```python
from hezar import Model

# OCR with TrOCR
model = Model.load("hezarai/trocr-fa-v1")
text = model.predict(["examples/assets/ocr_example.jpg"])
print(text)
texts = model.predict(["examples/assets/ocr_example.jpg"])
print(f"TrOCR Output: {texts}")

# OCR with CRNN
model = Model.load("hezarai/crnn-base-fa-64x256")
texts = model.predict("examples/assets/ocr_example.jpg")
print(f"CRNN Output: {texts}")
```
```
{'texts': [' چه میشه کرد، باید صبر کنیم']}
TrOCR Output: {'texts': [' چه میشه کرد، باید صبر کنیم']}
CRNN Output: {'texts': ['چه میشه کرد، باید صبر کنیم']}
```
We constantly keep working on adding and training new models and this section will hopefully be expanding every day ;)
### Word Embeddings
Expand Down

0 comments on commit ec89094

Please sign in to comment.