import requests import json import os ARTE_API_KEY = os.environ.get("ARTE_API_KEY") ARTE_BASE_URL = os.environ.get("ARTE_BASE_URL") arte_api_endpoint="ping_api" def ping_api(text, model_type="SBERT"): payload = { "APIkey": ARTE_API_KEY, # Replace with your actual API key "selection": [model_type], "text": text } json_payload = json.dumps(payload) headers = { 'Content-Type': 'application/json' } response = requests.post(ARTE_BASE_URL + arte_api_endpoint, data=json_payload, headers=headers) data = json.loads(response.text) return data.get(model_type).get("sc")