Trouble with the built in inference API example
Hi I’m just starting out with the inference API examples. While I can get other examples to work using the same formatting , I get this error{“error”:“d argument needs to be of type (SquadExample, dict)”}When using the example fordeepset/roberta-base-squad2 · Hugging Faceimport json
import requests

API_URL = "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2"
headers = {"Authorization": "Bearer api_xxx"}

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.",
        }
    }
)I’d love know how else to format the query, or what else I should double check.Thanks for reading.
2021-06-19T13:51:07Z
Hi@LowellRI just tried your exact pasted code and it worked fine.{'answer': 'Clara', 'end': 16, 'score': 0.9326569437980652, 'start': 11}Could you confirm if you are running this same code?Thanks!
2021-06-19T18:40:26Z
Thanks for taking a look@osansevieroI appreciate you testing it out. I must have some sort of formatting issue. I’ll take another look.