chillerie commited on
Commit
e9eafb5
·
1 Parent(s): cb4ec51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -5,17 +5,19 @@ headers = {"Authorization": f"Bearer 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"}
5
  API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-mnli"
6
 
7
  def query(payload):
8
- print("Querying payload....")
9
- print(payload)
10
- new_paylod = {
11
- "inputs": "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!",
12
- "parameters": {"candidate_labels": ["refund", "legal", "faq"]},
 
 
 
13
  }
14
- data = json.dumps(new_paylod)
15
-
16
- response = requests.request("POST", API_URL, headers=headers, data=data)
17
  return json.loads(response.content.decode("utf-8"))
18
-
19
 
20
  iface = gr.Interface(fn=query, inputs="text", outputs="text")
21
  iface.launch()
 
5
  API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-mnli"
6
 
7
  def query(payload):
8
+ #data = json.dumps(payload)
9
+ """
10
+ data = {
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
  }
17
+ """
18
+ response = requests.request("POST", API_URL, headers=headers, data=payload)
 
19
  return json.loads(response.content.decode("utf-8"))
20
+
21
 
22
  iface = gr.Interface(fn=query, inputs="text", outputs="text")
23
  iface.launch()