arao02 commited on
Commit
8c1ab9c
1 Parent(s): 89dbd01

Create InferenceAPI

Browse files
Files changed (1) hide show
  1. InferenceAPI +16 -0
InferenceAPI ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ API_URL = "https://api-inference.huggingface.co/models/microsoft/DialoGPT-medium"
4
+ headers = {"Authorization": "Bearer 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"}
5
+
6
+ def query(payload):
7
+ response = requests.post(API_URL, headers=headers, json=payload)
8
+ return response.json()
9
+
10
+ output = query({
11
+ "inputs": {
12
+ "past_user_inputs": ["Which movie is the best ?"],
13
+ "generated_responses": ["It's Die Hard for sure."],
14
+ "text": "Can you explain why ?"
15
+ },
16
+ })