Views
No views yet
1import requests
2
3API_URL = "https://ag765g6yhowax6vb.us-east4.gcp.endpoints.huggingface.cloud"
4headers = {
5 "Accept" : "application/json",
6 "Content-Type": "application/json"
7}
8
9def query(payload):
10 response = requests.post(API_URL, headers=headers, json=payload)
11 return response.json()
12
13prefix = "Determine whether the context is sufficient to answer the question:"
14question = "name the unit of mass that is used in the same measurement system as gray per second?"
15context = "('Gray per second', 'measurement_unit.absorbed_dose_rate_unit.measurement_system', 'International System of Units')"
16input_ = f"""{prefix}
17
18Question: {question}
19
20Context: {context}"""
21
22output = query({
23 "inputs": input_,
24 "parameters": {}
25})