I tried uploading an image using the Custom Vision prediction API enpoint for sending images, but I got back this error.
{'code': 'BadRequestImageFormat', 'message': 'Bad Request Image Format, Uri: ef9a72a7a60541f0bd7fbefc32f5e7b8'}
I used Python requests library, and set the files to the image bytes data.
To Reproduce
Steps to reproduce the behavior:
Go to Custom Vision Studio, click on Publish, then Performance.
Click on Prediction URL and select the credentials for 'If you have an image file'
In your .py file, set the headers = { 'Prediction-Key': key, 'Content-Type': 'application/octet-stream'}
Create the request image_request = requests.post(constructed_url, headers=headers, files=bytes_data)
Running that line gives the error
Expected behavior
It supposed to return a JSON response like this
{'id':.., 'project': ...', 'iteration':.., 'created': '2023-03-13T21:50:19.587Z', 'predictions': [{'probability': 0.9999995...
Screenshots
Desktop (please complete the following information):
OS: Windows 10
Browser: Chrome
Version: 110.0.5481.180
Additional context
I am trying to use REST API to upload an image to Azure Custom Service Prediction API with Python Requests library. The current documentation only supports the Python SDK.
🎓 Add a tag to this issue for your current education role: student, Student Ambassador or educator.
Thank you for submitting this issue! The team will review your issue, tag with the appropriate tags, and comment with any additional questions on information needed. :sparkles:
Describe the bug
I tried uploading an image using the Custom Vision prediction API enpoint for sending images, but I got back this error. {'code': 'BadRequestImageFormat', 'message': 'Bad Request Image Format, Uri: ef9a72a7a60541f0bd7fbefc32f5e7b8'} I used Python requests library, and set the files to the image bytes data.
To Reproduce
Steps to reproduce the behavior:
headers = { 'Prediction-Key': key, 'Content-Type': 'application/octet-stream'}
image_request = requests.post(constructed_url, headers=headers, files=bytes_data)
Expected behavior
It supposed to return a JSON response like this
{'id':.., 'project': ...', 'iteration':.., 'created': '2023-03-13T21:50:19.587Z', 'predictions': [{'probability': 0.9999995...
Screenshots
Desktop (please complete the following information):
Additional context
I am trying to use REST API to upload an image to Azure Custom Service Prediction API with Python Requests library. The current documentation only supports the Python SDK.
🎓 Add a tag to this issue for your current education role: student, Student Ambassador or educator.
Student Ambassador