Spaces:
Running
Running
import cloudscraper | |
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 | |
} | |
scraper = cloudscraper.create_scraper() | |
response = scraper.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)}") | |