I made a image classification using custom vision and published it. After that I got this publishing url and prediction key. Now I am literally confused how to use this as a api in a website that I am making using MERN.
Also the prediction url doesnt work- "{"error":{"code":"404","message": "Resource not found"}}"
This is the ouput details after publishing:
If you have an image URL:
https://assam-prediction.cognitiveservices.azure.com/customvision/v3.0/Prediction/**2/classify/iterations/TradiitionalVsWestern/url
Set Prediction-Key Header to : ***
Set Content-Type Header to : application/json
Set Body to : {"Url": "https://example.com/image.png"}
I reproduced the same thing in my environment. When you are request via GET method you will get a 404 error for predication. You can use prediction call by using the POST method as per MS document
To resolve the above use POST method and follow the steps.
You can use both image and Image URL.
Syntax of my prediction URL
https://democustv-prediction.cognitiveservices.azure.com/customvision/v3.0/Prediction/ecsxx /classify/iterations/Iteration1/image
Select your image down here
Now everting is working fine 200 OK.
Related
I try to render data on a static Azure Map. I followed this tutorial
I can successfully upload the Geo.json to the static map API and do a request to check the upload status. However in the documentation is stated that I should receive a response like this:
{"udid" : "{udId}"}
The actual response I get is:
{"operationId": "{udId}"}
The next step is to call the static map API to request the plotted image, however I cannot complete this step since the API is giving a 400 error bad request. I have tried with "udid-" and "operationId-" but both give the same error. The call looks like:
https://atlas.microsoft.com/map/static/png?subscription-key={key=hidden}version=1.0&layer=basic&style=main&zoom=12¢er=5.356764766897979,53.05137698634611&path=lc0000FF|fc0000FF|lw3|la0.80|fa0.30||operationId-{udId=hidden}
It looks like the documentation is not up-to-date or I did something wrong.
Looks like that tutorial is missing a step. After step 5 you have to grab the "Resource-Location" URL that's in the header of the operation response which points to the operation metadata. That will have the UID value in it. It will look something like this: https://us.atlas.microsoft.com/mapData/metadata/e0020b05-1f9b-5a8f-260f-87b7ef461432?api-version=2.0
Append your &subscription-key={your key} to that URL, and you will see the UID.
Alternatively, that GUID in the metadata URL is actually the UID, so you could parse it out instead of calling that service.
I'm trying to add an image that I've uploaded to Drive via the Drive API into a slide show I've created using the same API.
when Running the fairly standard:
response = (self
._slides_service
.presentations()
.batchUpdate(presentationId=slide_deck_id, body=body)
.execute()
)
I get:
googleapiclient.errors.HttpError: <HttpError 400 when requesting {url} returned "Invalid requests[0].createImage: The provided image is in an unsupported format.">
I'm generating the service in the same way as suggested in the documentation here: https://developers.google.com/slides/quickstart/python
My scope is:
https://www.googleapis.com/auth/presentations
If I run the command with a random png from the internet then it inserts the image fine. I've tried the url provided by webContentLink or WebViewLink values from the response from uploading the images. Neither are valid.
What URL will work to do this?
I'm aware there are other similar questions on stack overflow but all of them are not related to doing this in python or if they are, there solutions don't work.
EDIT:
body is:
{'requests': [{'createImage': {'url': url, 'elementProperties': {'pageObjectId': page_id}}}]}
had to generalise the url and page id because GDPR is a pain.
I have recorded the script in JMeter, and while validating it, it is throwing an error for the winauth/sso, how to resolve it. my app has oAuth and me have to authenticate it.
I'm running the script for WinAuth, it gets highlighted in red color and under Response Body, it is displaying "Unauthorized"
I have added the HTTP Cookie Manager (check CookieManager.save.cookies=true in jmeter.properties), HTTP Authorization Manager.[images are added down the below for verification purpose]
I'm not able to view the Token_id also.
Images:
1. showing winAuth sso error
2. showing all parameters with its respective values.
You have to do at least three steps:
Add HTTP Cookie Manager (and check
CookieManager.save.cookies=true in jmeter.properties)
Add HTTP Authorization Manager
Using the Regular Expression Extractor extract Authentification token from the first request (from login page) and send it to the second requests.
See that article to get ideas about how to use the Regular Expression Extractor to extract authentication token https://dzone.com/articles/how-to-load-test-saml-sso-secured-websites-with-jm
I am banging my head trying to use Flickr API...
My goal is to be able to upload images and create albums in my Flickr account from my website...
I tried the phpFlickr library but apparently it needs updates for getting authenticated tokens...It keeps giving me "Invalid auth token".
I did some reading on how to get tokens and using DPZFlickr managed to get oauth_token & oauth_verifier but failed to exchange that with an access token...It also failed in uploading any photo to my account using the included upload.php example (Giving me an "empty" error!).
After digging in DBZ flickr.php code, I managed to get this error when trying to upload to Flickr: "oauth_problem=signature_invalid&"
So I began to search how to create a valid signature to eventually get a valid access token...and concluded that it is quite some work to be done here if I am going to build everything from scratch.
So my question is: Are there any updated php libraries that I can use to successfully create albums and upload photos to my Flickr account? Or should I go ahead and try building one?
OK..I finally got it to work with the DPZ library.
For future reference anybody facing the same problem as I had:
I managed to create an album using DPZFlickr by changing the method in auth.php to flickr.photosets.create....which indicated that the library correctly generates an access token with write permission..
However, the upload example kept giving me the "Invalid signature" error....
I checked the code. Flickr.php correctly unsets the photo parameter before signing the request then adds it back and submits the request which is exactly as indicated in: www.flickr.com/services/api/upload.api.html
I found a discussion in https://www.flickr.com/groups/51035612836#N01/discuss/72157650261711318/ that cleared out that the error was not actually a signature problem, but rather the 'photo' parameter that is being sent is the problem. It's just that Flickr doesn't know what to do with the photo parameter so it sends the signature error.
So what' wrong with the photo parameter?
Flickr API requires that the image has to be sent in binary form...The DBZ library, Flickr.php script line 677, does the hard work for us using the cURL function in php (http://au.php.net/manual/en/function.curl-setopt.php).
It sends the $parameters (which includes the uploaded photo) to the post field of the http request which should do the upload in binary format for us.
However, a brilliant comment I found in CURL PHP send image
states that:
"CURLOPT_SAFE_UPLOAD defaulted to true in 5.6.0... so you will need to add curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); before setting CURLOPT_POSTFIELDS"
Checking the manual: http://au.php.net/manual/en/function.curl-setopt.php
it says:
"Added in PHP 5.5.0 with FALSE as the default value. PHP 5.6.0 changes the default value to TRUE."
So if your php version is 5.5.0 the library will work just fine whilst if using version PHP 5.6.0 you need to add a line before 677 in Flickr.php to change the CURLOPT_SAFE_UPLOAD to false (that's why the library works with some and others not).
To solve the issue...Just add this line before line 677 in Flickr.php:
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
That's it. (-:
I am new to Solr and PySolr and I am trying to create a web-app. I am planning to use PySolr but when I try to run an example script I get errors. Below are the details:
import pysolr
# Setup a Solr instance. The timeout is optional.
solr = pysolr.Solr('http://localhost:8983/solr/', timeout=10)
# How you'd index data.
solr.add([
{
"id": "doc_1",
"title": "A test document",
},
{
"id": "doc_2",
"title": "The Banana: Tasty or Dangerous?",
},
])
Then I get an error:
pysolr.SolrError: Solr responded with an error (HTTP 404): [Reason: None]
After looking up I found that the URL entered must not be correct, so I changed it to my collection's URL.
solr = pysolr.Solr('http://localhost:8983/solr/#/gettingstarted/', timeout=10)
Now I get the error below:
pysolr.SolrError: Solr responded with an error (HTTP 405): [Reason: None]
HTTP method POST is not supported by this URL
There are tons of questions on the above two errors, but all the resources I found are mostly dealing with some other specific scenarios. So, my question is that how do I give pySolr the correct URL and if the second URL is correct then how to deal with the above error.
The # part of an URL is never sent to the server - it's a local anchor that only the client itself should access. The URL you're using is the admin interface URL that the javascript in the admin interface uses to set up the current page to show.
The core is available directly under /solr, so the correct URL should be http://localhost:8983/solr/gettingstarted/.
You can also see this in the query interface inside the admin interface when making queries (the URL is shown at the top - you're interested in the part without the select handler).