...
Widget Connector | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Enable Process
Info |
---|
User The user must enable ‘Process’ Process on the left of the panel in the Camera tab to be able to process the image sent through API. |
...
Find a practical API demonstration in Python at GitHub Image Analyze API.
...
IP Address
If the project runs on a local computer, the address is 127.0.0.1. If a remote computer is accessed, then you need to use the IP address of the remote computer.
...
This is selected when starting the project.
API Key
If the project is running with the “Secure image analyze” option enabled, each request in the parameter query must contain the API key that is generated after you enable this option.
...
Code Block | ||
---|---|---|
| ||
'http://127.0.0.1:8000/analyze_image?api_key=553d7790-827c-11ec-978b-6da1176c0b00' |
the default is 8000.
Data
You can add extra information to the request. This string will be added to the context (the key is data). It is available only in the Code module (context variable).
...
Code Block | ||
---|---|---|
| ||
'http://127.0.0.1:8000/analyze_image' |
Example with API key
Code Block | ||
---|---|---|
| ||
'http://127.0.0.1:8000/analyze_image?api_key=SUPER_SECRET' |
Example Python code that sends images from a folder to the Pekat project with an API key:
...
Code Block | ||
---|---|---|
| ||
response = requests.post( url='http://127.0.0.1:8000/analyze_image?response_type=annotated_image', data=image.read(), headers={'Content-Type': 'application/octet-stream'} ) |
If there are multiple query parameters, connect with '&', e.g. with an API key:
Code Block | ||||
---|---|---|---|---|
| ||||
url='http://127.0.0.1:8000/analyze_image?api_key=728a9180-8357-11ec-b645-e917eb5f5d27&response_type=annotated_image' |
Context
context – a serialized context in JSON format. The contents are explained on the Context page. You can access the context json from the response using:
...