chillerie commited on
Commit
dc9ee59
·
1 Parent(s): d68d255

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -1,7 +1,23 @@
1
  import gradio as gr
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  iface.launch()
 
1
  import gradio as gr
2
+ import json
3
+ import requests
4
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
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
+ {
12
+ "inputs": "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!",
13
+ "parameters": {"candidate_labels": ["refund", "legal", "faq"]},
14
+ }
15
+ )
16
+ data = json.dumps(new_paylod)
17
+
18
+ response = requests.request("POST", API_URL, headers=headers, data=data)
19
+ return json.loads(response.content.decode("utf-8"))
20
+
21
 
22
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
23
  iface.launch()