I am facing errors when using my endpoint
I have deployed sentence-transformers/all-MiniLM-L6-v2 on an Azure instance and the endpoint does not work.I tested on the end point page itself and it threw an error “API Implementation Error: Invalid output: output must be of type Array”. I gathered from this error that maybe the output in not in an expected format but there is an output. So I thought let me check what the output format is. (screenshot 1)I ran the cURL code on an online cURL executor and this time I got a blank response. (screenshot 2)Can someone please point out what I may be doing wrong here.Screen Shot 21184×580 36.8 KB
2023-12-11T13:06:17Z
@sid-050175Hello. Could you resolve your problem? I am having the exact same problem, using the same model for computing sentence similarity.
2023-12-11T13:46:44Z
Hi, no I could not. Still trying to trouble shoot. I wrote to hugging face support but haven’t heard back from them yet. If you have any joy, please do tell meSid
2023-12-11T13:55:04Z
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)
2023-12-11T14:07:07Z
Thanks, will give it a shotSid