General questions

как перевести печатный текст в рукописный?

import requests import jsonapplication_key = "your_application_key" hmac_key = "your_hmac_key"url = "https://cloud.myscript.com/api/v4.0/recognition/rest/text"headers = { "Content-Type": "application/json", "Accept": "application/json", "Application-Key": application_key, "HMAC-SHA256": hmac_key, }payload = { "text": "This is an example text that needs to be converted to handwriting.", "language": "en_US", "resultTypes": ["TEXT", "IMAGE_CROPPED"], "export": { "imageParameters": { "width": 500, "height": 500, "format": "PNG", }, }, }response = requests.post(url, headers=headers, data=json.dumps(payload))image_data = response.json()["result"]["imageCropped"]["data"]# Обработка рукописного текста

1 Comment

Dear Vadim,


thank you for contacting us.


My understanding is that you would like to send REST requests via a python API?


First, I recommend you refer to our documentation: https://developer.myscript.com/docs/interactive-ink/latest/web/rest/architecture/


Then, the easier is that you play with the iinkJS: https://developer.myscript.com/docs/interactive-ink/latest/web/iinkjs/get-started/


Looking at the developer console of your web browser, you will have the header information, and see how you can format your payload. As an example, please find an example of Math request:

curl -X POST \
https://cloud.myscript.com/api/v4.0/iink/batch \
-H 'Accept: application/json,application/mathml+xml' \
-H 'Content-Type: application/json' \
-H 'applicationKey: ***-***' \
-d '{"configuration":{"math":{"mimeTypes":["application/x-latex","application/mathml+xml"],"solver":{"enable":true,"fractional-part-digits":3,"decimal-separator":".","rounding-mode":"half up","angle-unit":"deg"},"margin":{"bottom":10,"left":15,"right":15,"top":10},"eraser":{"erase-precisely":false}},"lang":"en_US","export":{"image-resolution":300,"jiix":{"bounding-box":false,"strokes":false,"text":{"chars":false,"words":true}}}},"xDPI":96,"yDPI":96,"contentType":"Math","theme":"ink {\ncolor: #000000;\n-myscript-pen-width: 1;\n-myscript-pen-fill-style: none;\n-myscript-pen-fill-color: #FFFFFF00;\n}\n.math {\nfont-family: STIXGeneral;\n}\n.math-solved {\nfont-family: STIXGeneral;\ncolor: #A8A8A8FF;\n}\n.text {\nfont-family: MyScriptInter;\nfont-size: 10;\n}\n","strokeGroups":[{"penStyle":null,"strokes":[{"x":[514,531,549,567,583,593,599,602,602,597,587,573,558,547,540,545,568,588,607,621,631,634,634,633,630,619,609,597,585,571],"y":[117,108,102,99,98,98,100,109,115,124,132,139,144,147,148,148,148,149,154,160,168,176,180,187,190,201,208,213,217,219],"t":[1674481572623,1674481572827,1674481572843,1674481572861,1674481572877,1674481572893,1674481572916,1674481572956,1674481572978,1674481572996,1674481573009,1674481573028,1674481573044,1674481573060,1674481573077,1674481573136,1674481573160,1674481573179,1674481573194,1674481573211,1674481573228,1674481573244,1674481573262,1674481573277,1674481573294,1674481573310,1674481573326,1674481573347,1674481573360,1674481573380],"pointerType":"mouse"},{"x":[724,724,724,723,719,718,715,714],"y":[104,120,127,154,182,191,215,220],"t":[1674481573722,1674481573813,1674481573819,1674481573842,1674481573865,1674481573872,1674481573904,1674481573927],"pointerType":"mouse"},{"x":[695,708,727,741,752,757],"y":[178,175,171,169,167,167],"t":[1674481574239,1674481574354,1674481574378,1674481574394,1674481574410,1674481574428],"pointerType":"mouse"},{"x":[838,835,832,830,830,832,847,860,870,873,875,875,872,861,850,839,831,828,839,852,869,887,895],"y":[144,141,136,133,130,127,121,119,119,121,125,136,157,180,204,227,243,252,250,245,239,235,233],"t":[1674481574765,1674481574793,1674481574826,1674481574844,1674481574879,1674481574895,1674481574910,1674481574926,1674481574944,1674481574960,1674481574980,1674481575012,1674481575027,1674481575042,1674481575061,1674481575076,1674481575093,1674481575109,1674481575177,1674481575193,1674481575211,1674481575227,1674481575236],"pointerType":"mouse"}]}],"height":209,"width":1920}'


Best regards,


Olivier

Login or Signup to post a comment