Willaim commited on
Commit
f0fe63b
·
1 Parent(s): c9b0079

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -0
README.md CHANGED
@@ -8,3 +8,15 @@ pinned: false
8
  ---
9
 
10
  Edit this `README.md` markdown file to author your organization card 🔥
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
 
10
  Edit this `README.md` markdown file to author your organization card 🔥
11
+
12
+ import requests
13
+
14
+ def query(payload, model_id, api_token):
15
+ headers = {"Authorization": f"Bearer {api_token}"}
16
+ API_URL = f"https://api-inference.huggingface.co/models/{model_id}"
17
+ response = requests.post(API_URL, headers=headers, json=payload)
18
+ return response.json()
19
+
20
+ model_id = "distilbert-base-uncased"
21
+ api_token = "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" # get yours at hf.co/settings/tokens
22
+ data = query("The goal of life is [MASK].", model_id, api_token)