wjm55 commited on
Commit
2e11453
·
1 Parent(s): df0e186

Update README to reflect changes in embedding response handling and adjust example usage

Browse files
Files changed (2) hide show
  1. README.md +3 -4
  2. test.py +15 -0
README.md CHANGED
@@ -66,10 +66,9 @@ data = {
66
 
67
  response = requests.post(url, headers=headers, json=data)
68
  result = response.json()
69
- embedding = result["embedding"]
70
 
71
- print(f"Embedding length: {len(embedding)}")
72
- print(f"First few values: {embedding[:5]}")
73
  ```
74
 
75
  ### JavaScript
@@ -90,7 +89,7 @@ async function getEmbedding(text) {
90
  );
91
 
92
  const data = await response.json();
93
- return data.embedding;
94
  }
95
 
96
  // Example usage
 
66
 
67
  response = requests.post(url, headers=headers, json=data)
68
  result = response.json()
 
69
 
70
+ print(f"Embedding length: {len(result)}")
71
+ print(f"First few values: {result[:5]}")
72
  ```
73
 
74
  ### JavaScript
 
89
  );
90
 
91
  const data = await response.json();
92
+ return data
93
  }
94
 
95
  // Example usage
test.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ url = "https://placingholocaust-vector-endpoint.hf.space/vectorize"
5
+ headers = {
6
+ "accept": "application/json",
7
+ "Content-Type": "application/json"
8
+ }
9
+ data = {
10
+ "text": "This is a text"
11
+ }
12
+
13
+ response = requests.post(url, headers=headers, json=data)
14
+ result = response.json()
15
+ print(result)