git clone
&cd
into the repopdm install
orpython -m pip install .
- Create the
.env
file usingenv.example
as a template pdm start
to upload the pipeline, OR/tests
for code snippets
Refer to /tests/test.py
for an example of how to call the API using POST requests.
Mystic.ai can't handle the files directly, they require uploading to the storage first. It can be managed by pipeline-ai or by using POST requests.
POST request snippet is @ upload_img
function in /tests/test.py
.
-
image (File): This should be a .png, .jpg, or other image file; or a URL when calling by API.
Important: the file should be uploaded to the storage first, see here for details, or
upload_img
function in/tests/test.py
for a snippet.upload_img
function takes file path as an argument! -
lang (str) [Optional]: The language to use for OCR. Can be one of the following:
'Russian': 'ru',
'English': 'en',
'Spanish': 'es',
'Portuguese': 'pt' | 'br',
'Uzbek': 'uz',
'French': 'fr',
'Farsi': 'fa',
'German': 'de',
'Indonesian': 'id'
Defaults to English.
- str: The OCR output as a JSON with bounding box coordinates, e.g.
[[[[[0, 0], [572, 0], [572, 54], [0, 54]], 'когда забыл 0 том,что закрыл квартиру ,вернулся,а она закрыта:']]]
If the language is Russian, the function uses a model trained on both English and Russian (see here). If the language is English or any other value/skipped, the function uses a model trained only on English.
Self-explanatory: documentation @ mystic.ai + a snippet @ tests/ppln.py
.
Requires pipeline-ai
to be installed.