Update main.py
Browse files
main.py
CHANGED
@@ -5,7 +5,7 @@ from typing import List
|
|
5 |
import os, platform
|
6 |
|
7 |
|
8 |
-
model = AutoModel.from_pretrained('
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
@@ -15,11 +15,5 @@ class Validation(BaseModel):
|
|
15 |
|
16 |
#Endpoint
|
17 |
@app.post("/jina_embedding")
|
18 |
-
async def
|
19 |
-
|
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()}
|
|
|
|
|
|
|
|
|
|
|
|