Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
"inputs":
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
-
|
| 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()
|