This commit is contained in:
Ronaldson Bellande 2024-06-29 10:44:22 -04:00
parent 267b73c579
commit 5daf137e8c
2 changed files with 13 additions and 3 deletions

View File

@ -32,7 +32,11 @@ def face_detection(image):
"image": img_base64
}
response = requests.post(api_url, json=payload)
headers = {
"Authorization": f"Bearer {api_access_key}"
}
response = requests.post(api_url, json=payload, headers=headers)
if response.status_code == 200:
result = response.json()
@ -55,7 +59,7 @@ def image_callback(msg):
def main():
global api_url, pub
global api_url, api_access_key, pub
config_file_path = os.path.join(os.path.dirname(__file__), '../config/configs.json')
@ -67,6 +71,7 @@ def main():
config = json.load(config_file)
url = config['url']
endpoint_path = config['endpoint_path']["face_detection"]
api_access_key = config["Bellande_Framework_Access_Key"]
# Initialize ROS node
if ros_version == "1":

View File

@ -34,7 +34,11 @@ def predict(image):
"image": img_base64
}
response = requests.post(api_url, json=payload)
headers = {
"Authorization": f"Bearer {api_access_key}"
}
response = requests.post(api_url, json=payload, headers=headers)
if response.status_code == 200:
result = response.json()
@ -67,6 +71,7 @@ def main():
config = json.load(config_file)
url = config['url']
endpoint_path = config['endpoint_path']["prediction"]
api_access_key = config["Bellande_Framework_Access_Key"]
# Initialize ROS node
if ros_version == "1":