Posting a concatenated data request to a Spaces API
I’m testing gradio API access for a HuggingFace Space; for an API that requires we post one image via its URL, I have successfully used:data = gr.processing_utils.encode_url_or_file_to_base64(image_url)r = requests.post(url=‘https://hf.space/embed/tmabraham/fastai_pet_classifier/+/api/predict/’, json={“data”:[data]})Can anyone provide an example of posting a concatenated data request to HF in a similar way? The API below expects (2) images (as str, as above) and an additional string. What is the best practice?Input Payload{“data”: [str | Dict, // represents base64 url data, or (if tool == “sketch”) a dict of image and mask base64 url data of ‘Image1’ image componentstr | Dict, // represents base64 url data, or (if tool == “sketch”) a dict of image and mask base64 url data of ‘Image2’ image componentstr, // represents selected choice of ‘Task’ radio component]}Response Object{“data”: [str, // represents base64 url data of ‘flow/disparity’ image component],“duration”: (float) // number of seconds to run function call}
2022-11-27T18:08:42Z
My JSON syntax for concatenation was fine, the server errors I saw were from a separate problem discussed inthis Spaces post.