Token Classification
Transformers
French
German
ocr_qa_assessment
ocr
bloomfilter
unigram
impresso
quality-assessment
v1.0.6
custom_code
Instructions to use impresso-project/ocr-quality-assessor-unigram-light with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use impresso-project/ocr-quality-assessor-unigram-light with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="impresso-project/ocr-quality-assessor-unigram-light", trust_remote_code=True)# Load model directly from transformers import AutoModelForTokenClassification model = AutoModelForTokenClassification.from_pretrained("impresso-project/ocr-quality-assessor-unigram-light", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
197e8c2
1
Parent(s): fce343d
repaired import
Browse files- modeling_ocrqa.py +1 -1
- test.py +14 -0
modeling_ocrqa.py
CHANGED
|
@@ -5,7 +5,7 @@ import logging
|
|
| 5 |
import floret
|
| 6 |
import os
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
-
from .
|
| 9 |
|
| 10 |
logger = logging.getLogger(__name__)
|
| 11 |
from pybloomfilter import BloomFilter
|
|
|
|
| 5 |
import floret
|
| 6 |
import os
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
+
from .configuration_ocrqa import ImpressoConfig
|
| 9 |
|
| 10 |
logger = logging.getLogger(__name__)
|
| 11 |
from pybloomfilter import BloomFilter
|
test.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
MODEL_NAME = "impresso-project/ocr-quality-assessment-light"
|
| 4 |
+
|
| 5 |
+
ocrqa_pipeline = pipeline("ocr-qa-assessment", model=MODEL_NAME,
|
| 6 |
+
trust_remote_code=True,
|
| 7 |
+
device='cpu')
|
| 8 |
+
|
| 9 |
+
sentence = """En l'an 1348, au plus fort des ravages de la peste noire à travers l'Europe,
|
| 10 |
+
le Royaume de France se trouvait à la fois au bord du désespoir et face à une opportunité."""
|
| 11 |
+
|
| 12 |
+
score = ocrqa_pipeline(sentence)
|
| 13 |
+
print(score)
|
| 14 |
+
|