Spaces:
Sleeping
Sleeping
add more logging
Browse files
app.py
CHANGED
|
@@ -32,20 +32,23 @@ async def openai_embeddings(request: Request):
|
|
| 32 |
|
| 33 |
print("Creating client...");
|
| 34 |
SpaceClient = Client(SpacePath, token = BearerToken)
|
| 35 |
-
|
| 36 |
|
| 37 |
if not apiName:
|
| 38 |
apiName = "/embed"
|
| 39 |
|
| 40 |
text = body['input'];
|
| 41 |
|
|
|
|
| 42 |
result = SpaceClient.predict(
|
| 43 |
text=text,
|
| 44 |
api_name=apiName
|
| 45 |
)
|
|
|
|
|
|
|
| 46 |
embeddings = json.loads(result);
|
| 47 |
|
| 48 |
-
|
| 49 |
return {
|
| 50 |
'object': "list"
|
| 51 |
,'data': [{
|
|
|
|
| 32 |
|
| 33 |
print("Creating client...");
|
| 34 |
SpaceClient = Client(SpacePath, token = BearerToken)
|
| 35 |
+
print(" Created!");
|
| 36 |
|
| 37 |
if not apiName:
|
| 38 |
apiName = "/embed"
|
| 39 |
|
| 40 |
text = body['input'];
|
| 41 |
|
| 42 |
+
print("Predicting...");
|
| 43 |
result = SpaceClient.predict(
|
| 44 |
text=text,
|
| 45 |
api_name=apiName
|
| 46 |
)
|
| 47 |
+
|
| 48 |
+
print("Loading result embeddings from json...");
|
| 49 |
embeddings = json.loads(result);
|
| 50 |
|
| 51 |
+
print("Returning...");
|
| 52 |
return {
|
| 53 |
'object': "list"
|
| 54 |
,'data': [{
|