Hey so I had this code which I was using to make an inference request to the huggingface server. It used to work fine but just now it started giving this error
def bart_inference(text: str, percent: int) -> str:
total_length = len(text.split(" "))
min_length = (total_length * percent) // 100
headers = {"Authorization": f"Bearer {HF_API_KEY}"}
url = "https://api-inference.huggingface.co/models/google/pegasus-xsum"
data = json.dumps(
{
"inputs": text,
"parameters": {
"min_length": min_length,
"max_length": (min_length + 60),
"do_sample": False,
},
}
)
print("dafs")
response = requests.request("POST", url, headers=headers, data=data)
print(response.status_code)
print(response.json())
return json.loads(response.content.decode("utf-8"))
The error:-
{'error': "Can't load tokenizer using from_pretrained, please update its configuration: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on."}