cURL API Samples?

I can’t seem to get it to work in python…
Using: https://curl.trillworks.com/ for cURL conversion

import requests

headers = {
‘Content-Type’: ‘multipart/form-data’,
}

files = {
‘data’: (None, ‘{“key”: “img”};type’),
‘img’: (’/path/to/image.png’, open(’/path/to/image.png’, ‘rb’)),
}

response = requests.post(‘http://127.0.0.1:8881/models/test/v1/predict’, headers=headers, files=files)

Hi @danaman123,

you can try the below example with python

import requests

files = {'img': open('/path/to/image.png', 'rb')}
values = {'key': 'img'}

r = requests.post('http://127.0.0.1:8881/models/test/v1/predict', files=files, data=values)
if r.status_code == requests.codes.ok:
    resp = r.json()
    print(resp)