File size: 815 Bytes
a804a7a c064620 aba2a98 c064620 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
---
library_name: transformers
tags: []
---
# Inference with Dedicated Endpoint
```python
import requests
API_URL = "https://ag765g6yhowax6vb.us-east4.gcp.endpoints.huggingface.cloud"
headers = {
"Accept" : "application/json",
"Content-Type": "application/json"
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
prefix = "Determine whether the context is sufficient to answer the question:"
question = "name the unit of mass that is used in the same measurement system as gray per second?"
context = "('Gray per second', 'measurement_unit.absorbed_dose_rate_unit.measurement_system', 'International System of Units')"
input_ = f"""{prefix}
Question: {question}
Context: {context}"""
output = query({
"inputs": input_,
"parameters": {}
})
``` |