max I was wondering, if it's possible to have some direction on how to use the yolov5 serve app using js.
I have formated my request as following, but am getting no where with it, as it shuts down the serve yolov5 app.
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var url = "https://app.supervise.ly/public/api/v3/tasks.request.direct";
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("x-api-key", "key goes here");
xhr.setRequestHeader('Content-Type', 'application/json');
image_url = "https://i.imgur.com/tEkCb69.jpg"
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};
const json = {
"taskId": 325348,
"command": "inference_image_url",
"data": {
"image_id": image_url,
},
};
xhr.send(JSON.stringify(json));
```
my error:
```
Unexpected exception in main. main_name=main, stack=[
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/supervisely_lib/function_wrapper.py", line 15, in main_wrapper
main_func(*args, **kwargs)
File "/sessions/325348/repo/supervisely/serve/src/sly_serve.py", line 204, in main
my_app.run(initial_events=[{"command": "preprocess"}])
File "/usr/local/lib/python3.8/dist-packages/supervisely_lib/app/app_service.py", line 286, in run
raise self._error
File "/usr/local/lib/python3.8/dist-packages/supervisely_lib/app/app_service.py", line 191, in handle_message_sync
self.callbacks[command](api=user_public_api,
File "/usr/local/lib/python3.8/dist-packages/supervisely_lib/decorators/profile.py", line 11, in wrapper_timer
value = func(*args, **kwargs)
File "/sessions/325348/repo/supervisely/serve/src/sly_serve.py", line 113, in inference_image_url
image_url = state["image_url"]
TypeError: 'NoneType' object is not subscriptable
```