import json

import requests

headers = {"Authorization": f"Bearer {API_TOKEN}"}
API_URL = "https://api-inference.huggingface.co/models/bert-base-uncased"

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": "The answer to the universe is [MASK]."})
{}
pytorch region:us
TAGS
#pytorch #region-us 

import json

import requests

headers = {"Authorization": f"Bearer {API_TOKEN}"}
API_URL = "URL

def query(payload):
    data = URL(payload)
    response = requests.request("POST", API_URL, headers=headers, data=data)
    return URL(URL("utf-8"))

data = query({"inputs": "The answer to the universe is [MASK]."})
TAGS
#pytorch #region-us 

passage: TAGS
#pytorch #region-us 
