Files
SivananthamandGitHub a869657f25 Fix python linter (#3571)
* Fix python linter

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

* Format e2e tests

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

* Format hack, docs

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

* Add py-fmt target

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

* Update python lint workflow

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

* Rebase master

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>

---------

Signed-off-by: Sivanantham Chinnaiyan <[email protected]>
2024-04-05 11:15:12 -04:00

39 lines
772 B
Python

import sys
import requests
import json
import time
if len(sys.argv) < 3:
raise Exception("No endpoint specified. ")
endpoint = sys.argv[1]
headers = {"Host": sys.argv[2]}
payload_file = "input.json"
if len(sys.argv) > 3:
payload_file = sys.argv[3]
with open(payload_file) as file:
payload = json.load(file)
print("Sending bias query...")
x = time.time()
res = requests.post(endpoint, json=payload, headers=headers)
print("TIME TAKEN: ", time.time() - x)
print(res)
if not res.ok:
res.raise_for_status()
res_json = res.json()
# If this is an explanation request
if "metrics" in res_json:
for metric in res_json["metrics"]:
print(metric, ": ", res_json["metrics"][metric])
# Else if it is a prediction request
else:
print(res_json)