Why I can not get the model status via curl in tensorflow serving - tensorflow-serving

First: I startup the sample 'half_plus_two_2_versions' via tensorflow_model_server
Second: I use 'curl -X GET http://localhost:8501/v1/models/half_plus_two_2_versions', but I get the error message: { "error": "Malformed request: GET /v1/models/half_plus_two_2_versions" }
Who can help me, thanks.
I can use the following command get the result:
curl -d '{"instances": [1.0, 2.0, 5.0]}' -X POST http://localhost:8501/v1/models/half_plus_two_2_versions:predict
Result:
{ "predictions": [2.5, 3.0, 4.5 ] }
Thanks.
I already solve this problem.

Related

fulfillment shopify api not working 2023-01

I am trying to use this api /fulfillments.json in shopify but i am getting error {"errors":"Not Found"}
my code is here
curl --location --request POST 'https://logixgrid-save.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: 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' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment": {
"message": "The package was shipped this morning.",
"notify_customer": false,
"tracking_info": {
"number": 1562678,
"url": "https://www.my-shipping-company.com",
"company": "my-shipping-company"
},
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 5247929286964,
"fulfillment_order_line_items": [
{
"id": 1058737495,
"quantity": 1
}
]
}
]
}
}'
Here is my test store detail you can try this i will delete all these after 2 days
i am getting this response
{"errors":"Not Found"}
Most likely this is because 1058737495 id was took directly from documentation and you don't have such line_item in your order.
EDIT: Your fulfillment order id is wrong. You can get correct one by fetching /admin/api/2023-01/orders/{{ order.id}}/fulfillment_orders.json. This will return array of fulfillment orders. Try one of the ids - it should be working.
curl -X GET "https://redacted.myshopify.com/admin/api/2023-01/orders/5250054553908/fulfillment_orders.json" \
-H "X-Shopify-Access-Token: shpca_redacted"

migrate ffprobe command to ffmpeg-python

I currently am trying to migrate the following command from ffprobe to ffmpeg-python
ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
I tried the following and it did not work
ffmpeg.probe(file_path, v='error', select_streams='v:0', count_packets=True, show_entries=True, stream='nb_read_packets', of=True, csv='p=0')
I have tried this inputting it as a dictionary as well
ffmpeg.probe(file_path, **{'v':'error', 'select_streams':'v:0', 'count_packets':1, 'show_entries':1, 'stream':'nb_read_packets', 'of':'csv=p=0'})
But none of these seem to work, any help would be appreciated
TL;DR Answer
With the way the parameters for the python bindings for ffmpeg-python work, the format of the command you are inputting is incorrect. Instead the following should work for you
import ffmpeg, json
out = ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets')
out["streams"][0]["nb_read_packets"]
Complete Answer
Digging through the API reference for the ffmpeg-python module, the python binding ffmpeg.probe, states that it will
Run ffprobe on the specified file and return a JSON representation of
the output.
Debugging through the module/source code, this python binding for ffprobe will always add the command line options -show_format, -show_streams, -of json to your command that you pass in as defined in the
_probe.py file.
So for the ffprobe command you provided:
ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
will essentially be this command line options after passing through ffmpeg.fprobe:
ffprobe -show_format -show_streams -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 -of json input.mp4
I downloaded an mp4 video that was probably a chromecast commercial based on the description. Here's the gist link that I found it from, and look for the title "For Bigger Escape". I downloaded the file and renamed it input.mp4 to match the example you provided.
After running
>ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4
361
>
I get 361.
Now running the command:
ffprobe -show_format -show_streams -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 -of json input.mp4
I get the output
{
"programs": [
],
"streams": [
{
"nb_read_packets": "361",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "VideoHandler"
}
}
],
"format": {
"filename": "input.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "15.045000",
"size": "2299653",
"bit_rate": "1222813",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "0",
"compatible_brands": "isommp42",
"creation_time": "2013-11-12T06:38:58.000000Z"
}
}
}
That value of 361 is now in key value of nb_read_packets
I tried exactly replicating the command line
out= ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets', of='csv=p=0')
in ffmpeg-python, but I keep getting a JSONDecodeError:
The value of s from the debugger showed this string value:
s
'361,1,0,0,0,0,0,0,0,0,0,0,0,und,VideoHandler\r\ninput.mp4,2,0,"mov,mp4,m4a,3gp,3g2,mj2",QuickTime / MOV,0.000000,15.045000,2299653,1222813,100,mp42,0,isommp42,2013-11-12T06:38:58.000000Z\r\n'
My only assumption is with the -of or -print_format option, some characters were stripped or modified and that is giving the json decoder issues to decode it.
I finally decided to take out the -of csv=p=0 flag and the following was able to run with no errors
import ffmpeg, json
out = ffmpeg.probe("input.mp4", cmd='ffprobe', v='error', select_streams='v:0', count_packets=None, show_entries='stream=nb_read_packets')
value = out["streams"][0]["nb_read_packets"]
print(value)
361
Side Note
Some of the options that do not have direct parameters following them are defined as None because they do not have any parameters. This has been brought up several times in open issues from the github repo, and I have previously commented on it. It is not stated in the documents, and as far as I know, no PRs are out to update the docs to explicitly state it.

Cannot create new Pipeline using Az DevOps Pipelines API 6.0-preview.1

I'm trying to create new Pipelines using this API endpoint:
POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1
This is the request I'm using:
curl -X POST \
'https://dev.azure.com/<myorg>/<myproj>/_apis/pipelines?api-version=6.0-preview.1' \
-H 'Authorization: Basic <b64string>' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"configuration":{
"repository": {
"id": "<repo-guid>",
"name": "<repo-name>",
"type": "azureReposGit"
},
"path": "pipeline.yaml",
"type": "yaml"
},
"folder": "\\custompath\\",
"name": "<pipelinename>"
}
I keep getting the same error:
{
"$id": "1",
"innerException": null,
"message": "Value cannot be null.\r\nParameter name: repositoryName",
"typeName": "System.ArgumentNullException, mscorlib",
"typeKey": "ArgumentNullException",
"errorCode": 0,
"eventId": 0
}
It seems an issue with my payload, but documentation isn't very helpful about it
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/create?view=azure-devops-rest-6.0
Current version o nodejs sdk doesn't support the Pipeline API yet. Can anyone help me?
I'm able to reproduce your issue on my side, and have reported this issue at website below:
https://developercommunity.visualstudio.com/content/problem/1101376/create-pipeline-rest-api-does-not-work.html
Product team has provided response that "A fix for this issue has been prepared. It should be released to everyone within the next 3 weeks."

What is the supossed scope for translating file format to SFV?

Im going along with the tutorial from:
https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer/
and i got stuck with translating the file to SVF. I've tried data:write, data:create, bucket:update scopes but each time I get:
Token does not have the privilege for this request.
{
"input": {
"urn": "someUrn="
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
You will need both data:read and (data:write or data:create) (delimited by space) - see doc here:
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate'
-X 'POST'
-H 'Content-Type: application/x-www-form-urlencoded'
-d '
client_id=obQDn8P0GanGFQha4ngKKVWcxwyvFAGE&
client_secret=eUruM8HRyc7BAQ1e&
grant_type=client_credentials&
scope=data:read%20data:write
'
And did you select Model Derivative API when creating the Forge app - if not, start over and create the app again:
Thanks,
I've run also with some different translation errors, but it turns out .rfa files are not supported in the Model Derivative API.
But all in all it worked out

ICINGA2 API Not making host modification

i have problem with the API of ICINGA2.
i'm trying to add new variables with the POST call ,
i'm getting the required result,
But ICINGA2 didn't add the new var.
According to documentation:
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/icinga2-api
With the following API, i creates all our hosts in vienna :
curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/hosts/server.example.com' \
-d '{ "templates": [ "generic-host" ], "attrs": { "zone": "Vienna", "address": "180.33.1.123", "check_command": "hostalive", "vars.os" : "Linux", "vars.agent" : "ssh" } }' \
| python -m json.tool
While this part works as expected,
The problem is once host created, i need to add various vars for different servers.
for example
Adding of the variable: "vars.servicename" : "DHCP_Servers"
If i'm going back to the documentation, the below API that will need to be execute:
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/hosts/server.example.com' \
-d '{ "templates": [ "generic-host" ], "attrs": { "zone": "Vienna", "address": "180.33.1.123", "check_command": "hostalive", "vars.os" : "Linux", "vars.agent" : "ssh", "vars.servicename" : "DHCP_Servers" } }' \
| python -m json.tool
When i ran the API , as expected i'm getting back:
{
"results": [
{
"code": 200.0,
"name": "server.example.com",
"status": "Attributes updated.",
"type": "Host"
}
]
}
But there is no changes that taking place on ICINGA/ host file.
Obviously the same user as in my inbox and the forums (https://monitoring-portal.org/index.php?thread/37160-adding-vars-with-api/&postID=234885#post234885) lately. Leaving this as a note here as it might help others to see why it does not work. That feature is just not implemented as it involves storing the applied changes, do a rollback, and re-apply. Not as simple as it sounds.
https://dev.icinga.org/issues/11501