Spaces:
Sleeping
Sleeping
Commit
•
dcd51f5
1
Parent(s):
265959d
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,8 @@ security = HTTPBearer()
|
|
40 |
|
41 |
def query(payload):
|
42 |
response = requests.post(API_URL, headers=headers, json=payload)
|
43 |
-
|
|
|
44 |
|
45 |
class EmbeddingRequest(BaseModel):
|
46 |
input: List[str]
|
@@ -95,6 +96,7 @@ async def get_embeddings(request: EmbeddingRequest, credentials: HTTPAuthorizati
|
|
95 |
# embeddings = [model.encode(text) for text in request.input]
|
96 |
print(request.json())
|
97 |
embeddings = query(request.input)
|
|
|
98 |
prompt_tokens = sum(len(text.split()) for text in request.input)
|
99 |
total_tokens = sum(num_tokens_from_string(text) for text in request.input)
|
100 |
|
|
|
40 |
|
41 |
def query(payload):
|
42 |
response = requests.post(API_URL, headers=headers, json=payload)
|
43 |
+
print(reponse.json)
|
44 |
+
return response.json()[0]
|
45 |
|
46 |
class EmbeddingRequest(BaseModel):
|
47 |
input: List[str]
|
|
|
96 |
# embeddings = [model.encode(text) for text in request.input]
|
97 |
print(request.json())
|
98 |
embeddings = query(request.input)
|
99 |
+
print(embeddings)
|
100 |
prompt_tokens = sum(len(text.split()) for text in request.input)
|
101 |
total_tokens = sum(num_tokens_from_string(text) for text in request.input)
|
102 |
|