moraxgiga commited on
Commit
00c47eb
1 Parent(s): 8590b7d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -9
main.py CHANGED
@@ -5,7 +5,7 @@ from typing import List
5
  import os, platform
6
 
7
 
8
- model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-en', trust_remote_code=True)
9
 
10
  app = FastAPI()
11
 
@@ -15,11 +15,5 @@ class Validation(BaseModel):
15
 
16
  #Endpoint
17
  @app.post("/jina_embedding")
18
- async def chaatie_agent(item: Validation):
19
- # Assuming model.encode returns a list of numpy arrays (one for each prompt)
20
- embeddings = model.encode(item.prompt)
21
-
22
- # Convert each numpy array in the list to a list
23
- embeddings_list = [embedding.tolist() for embedding in embeddings]
24
-
25
- return {"embeddings": embeddings_list}
 
5
  import os, platform
6
 
7
 
8
+ model = AutoModel.from_pretrained('moraxgiga/jina', trust_remote_code=True)
9
 
10
  app = FastAPI()
11
 
 
15
 
16
  #Endpoint
17
  @app.post("/jina_embedding")
18
+ async def generate_embeddings(text):
19
+ return {"embeddings": model.encode(text).tolist()}