Skip to content

Commit 78f3704

Browse files
committed
Enhance documentation: fix comments - 1
1 parent 74b3e0f commit 78f3704

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Regula Document Reader web API Python 3.5+ client
22

33
[![pypi](https://img.shields.io/pypi/v/regula.documentreader.webclient?style=flat-square)](https://support.regulaforensics.com/hc/en-us/articles/115000916306-Documentation)
4+
[![OpenAPI](https://img.shields.io/badge/OpenAPI-defs-8c0a56?style=flat-square)](https://github.com/regulaforensics/DocumentReader-web-openapi)
45
[![documentation](https://img.shields.io/badge/docs-en-f6858d?style=flat-square)](https://support.regulaforensics.com/hc/en-us/articles/115000916306-Documentation)
5-
[![OpenAPI](https://img.shields.io/badge/OpenAPI-defs-0a8c42?style=flat-square)](https://github.com/regulaforensics/DocumentReader-web-openapi)
6+
[![live](https://img.shields.io/badge/live-demo-0a8c42?style=flat-square)](https://api.regulaforensics.com/)
67

78
Documents recognition as easy as reading two bytes.
89

910
If you have any problems with or questions about this client, please contact us
1011
through a [GitHub issue](https://github.com/regulaforensics/DocumentReader-web-python-client/issues).
11-
You are invited to contribute [new features, fixes, or updates](https://github.com/regulaforensics/DocumentReader-web-python-client/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22), large or small; We are always thrilled to receive pull requests, and do our best to process them as fast as we can.
12+
You are invited to contribute [new features, fixes, or updates](https://github.com/regulaforensics/DocumentReader-web-python-client/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22), large or small;
13+
We are always thrilled to receive pull requests, and do our best to process them as fast as we can.
14+
See [dev guide](./dev.md)
1215

1316
## Install package
1417
`regula.documentreader.webclient` is on the Python Package Index (PyPI):
@@ -35,7 +38,7 @@ with open("australia_passport.jpg", "rb") as f:
3538
with DocumentReaderApi(host='http://localhost:8080') as api:
3639
params = ProcessParams(
3740
scenario=Scenario.FULL_PROCESS,
38-
result_type_output=[Result.RAW_IMAGE, Result.STATUS, Result.TEXT, Result.IMAGES]
41+
result_type_output=[Result.DOCUMENT_IMAGE, Result.STATUS, Result.TEXT, Result.IMAGES]
3942
)
4043
request = RecognitionRequest(process_params=params, images=[input_image])
4144
response = api.process(request)
@@ -56,24 +59,9 @@ doc_number_mrz_validity = doc_number_field.source_validity(Source.MRZ)
5659
doc_number_mrz_visual_matching = doc_number_field.cross_source_comparison(Source.MRZ, Source.VISUAL)
5760

5861
# images fields example
59-
normalized_input_image = response.images.normalized_input_image()
62+
normalized_input_image = response.images.document_image()
6063
portrait_field = response.images.get_field(GraphicFieldType.PORTRAIT)
6164
portrait_from_visual = portrait_field.get_value(Source.VISUAL)
6265
portrait_from_rfid = portrait_field.get_value(Source.RFID, original=True)
6366
```
6467
You can find more detailed guide and run this sample in [example](./example) folder.
65-
66-
## Development
67-
68-
To regenerate models, clone [latest OpenAPI definitions](https://github.com/regulaforensics/DocumentReader-web-openapi)
69-
and set `DEFINITION_FOLDER` as path to cloned directory, for example:
70-
```bash
71-
DEFINITION_FOLDER="/home/user/projects/DocumentReader-web-openapi"
72-
```
73-
Then use next command from the project root:
74-
```bash
75-
docker run --rm -v "${PWD}:/client" -v "${DEFINITION_FOLDER}:/definitions" \
76-
openapitools/openapi-generator-cli generate -g python \
77-
-i /definitions/index.yml -o /client -c /client/generator-config.json \
78-
-t /client/generator-templates
79-
```

dev.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Development
2+
3+
To regenerate models, clone [latest OpenAPI definitions](https://github.com/regulaforensics/DocumentReader-web-openapi)
4+
and set `DEFINITION_FOLDER` as path to cloned directory, for example:
5+
```bash
6+
DEFINITION_FOLDER="/home/user/projects/DocumentReader-web-openapi"
7+
```
8+
Then use next command from the project root:
9+
```bash
10+
docker run --rm -v "${PWD}:/client" -v "${DEFINITION_FOLDER}:/definitions" \
11+
openapitools/openapi-generator-cli generate -g python \
12+
-i /definitions/index.yml -o /client -c /client/generator-config.json \
13+
-t /client/generator-templates
14+
```

example/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Regula Document Reader web API Python 3.5+ client
22

3-
## Running example
3+
Before you start: if you just want to play with an online demo, visit our [playground](https://api.regulaforensics.com).
4+
5+
## Running local example
46

57
Requirements:
68
- installed python 3.5 or higher
79
- installed [pipenv](https://pypi.org/project/pipenv)
8-
- running Regula Document Reader web application(todo link for docker run?) with trial license(todo edit desc here)
10+
- running [Regula Document Reader web API with trial license](https://docs.regulaforensics.com/web/quick-start-guide)
911

1012
Cloning example
1113
```bash
@@ -26,7 +28,7 @@ pipenv run python example.py
2628
API_BASE_PATH="http://192.168.0.101:8080" pipenv run python example.py
2729
```
2830

29-
This sample generate next text output:
31+
This sample generates next text output:
3032
```text
3133
---------------------------------------------------------------------------
3234
Document Overall Status: not valid
@@ -37,7 +39,7 @@ This sample generate next text output:
3739
MRZ-Visual values comparison: 1
3840
---------------------------------------------------------------------------
3941
```
40-
Also, it creates [portrait](portraitFromVisual.jpg) and [normalized input](normalizedInputImage.jpg)
42+
Also, it creates [portrait](portrait.jpg) and [document image](document-image.jpg)
4143
pictures inside current folder.
4244

4345
Edit on your own [example.py](./example.py), and re-run to see your results.

example/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
# images fields example
3737
document_image = response.images.document_image()
38-
portrait_Field = response.images.get_field(GraphicFieldType.PORTRAIT)
39-
portrait_From_Visual = portrait_Field.get_value(Source.VISUAL)
40-
with open('portrait.jpg', 'wb') as f: f.write(portrait_From_Visual)
38+
portrait_field = response.images.get_field(GraphicFieldType.PORTRAIT)
39+
portrait_from_visual = portrait_field.get_value(Source.VISUAL)
40+
with open('portrait.jpg', 'wb') as f: f.write(portrait_from_visual)
4141
with open('document-image.jpg', 'wb') as f: f.write(document_image)
4242

4343
# low-lvl(original) response

0 commit comments

Comments
 (0)