Data structure: Accelerated Inference API

Hi,

new to the forum, so I hope the question isn’t to silly :frowning:

I try to copy examples on the blog post of one-shot learning, but I can’t figure out the payload format.
The snippet: (Detailed parameters)

import json
import requests
headers = {"Authorization": f"Bearer {API_TOKEN}"}
API_URL = "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2"
def query(payload):
    data = json.dumps(payload)
    response = requests.request("POST", API_URL, headers=headers, data=data)
    return json.loads(response.content.decode("utf-8"))
data = query(
    {
        "inputs": {
            "question": "What's my name?",
            "context": "My name is Clara and I live in Berkeley.",
        }
    }
)

print(data)
 'Error:u n k n o w n   e r r o r'

In a later phase I wish to use this with few-shot learning, so if you have the solution :wink:

thanks,

Andreas