Update README.md
Browse files
README.md
CHANGED
|
@@ -11,7 +11,6 @@ tags: []
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
-
### Model Description
|
| 15 |
|
| 16 |
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
|
|
@@ -21,45 +20,32 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 21 |
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):**
|
| 25 |
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [
|
| 27 |
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
## Uses
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
|
| 58 |
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
|
|
|
| 14 |
|
| 15 |
<!-- Provide a longer summary of what this model is. -->
|
| 16 |
|
|
|
|
| 20 |
- **Funded by [optional]:** [More Information Needed]
|
| 21 |
- **Shared by [optional]:** [More Information Needed]
|
| 22 |
- **Model type:** [More Information Needed]
|
| 23 |
+
- **Language(s) (NLP):** German
|
| 24 |
- **License:** [More Information Needed]
|
| 25 |
+
- **Finetuned from model [optional]:** [TrOCR_large_handwritten](https://huggingface.co/microsoft/trocr-large-handwritten)
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
## Uses
|
| 29 |
|
| 30 |
+
Here is how to use this model in PyTorch:
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
|
| 34 |
+
from PIL import Image
|
| 35 |
+
import requests
|
| 36 |
+
# load image from the IAM database
|
| 37 |
+
url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
|
| 38 |
+
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 39 |
+
processor = TrOCRProcessor.from_pretrained('TGrote11/testModel')
|
| 40 |
+
model = VisionEncoderDecoderModel.from_pretrained('TGrote11/testModel')
|
| 41 |
+
pixel_values = processor(images=image, return_tensors="pt").pixel_values
|
| 42 |
+
generated_ids = model.generate(pixel_values)
|
| 43 |
+
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 44 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
## Bias, Risks, and Limitations
|
| 47 |
|
| 48 |
+
You can use the raw model for optical character recognition (OCR) on single text-line images of german handwriting.
|
|
|
|
|
|
|
| 49 |
|
| 50 |
### Recommendations
|
| 51 |
|