File size: 612 Bytes
e397647
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests
import json


def embeddings_run(input,url= "https://sanbo1200-jina-embeddings-v3.hf.space/api/v1/embeddings",model="jinaai/jina-embeddings-v3"):

 
    headers = {
        "Content-Type": "application/json"
    }

    data = {
        "input": input,
        "model":model
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))
    response.encoding="utf-8"
    response.raise_for_status()

    if response.status_code == 200:
        return response.json()

if __name__ == "__main__":
    input = "Your text string goes here"
    print(f"---{embeddings_run(input)}")