I am facing errors when using my endpoint

I could solve it in the meantime. Funnily it only works when using programmatically, not from the UI.

from dotenv import load_dotenv

load_dotenv()
import os

import requests
from requests.adapters import HTTPAdapter


def get_similarity(string1, string2):
    API_URL = XXX

    headers = {
        "Authorization": f"Bearer {os.getenv('HF_API_KEY')}",
        "Content-Type": "application/json"
    }

    def query(payload):
        response = requests.post(API_URL, headers=headers, json=payload, timeout=5)
        return response.json()
        
    output = query({
        "inputs": {
            "source_sentence": string1,
            "sentences": [
                string2
            ]
        },
    })

    # print(output)

    return output

if __name__ =='__main__':
    output = get_similarity("I like apples", "I like oranges")
    print(output)