File size: 449 Bytes
7430631 edd62aa 7430631 a260b1b 00c47eb be4dd45 00c47eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel, root_validator
from transformers import AutoModel
from typing import List
import os, platform
model = AutoModel.from_pretrained('moraxgiga/jina', trust_remote_code=True)
app = FastAPI()
class Validation(BaseModel):
prompt: List[str]
#Endpoint
@app.post("/jina_embedding")
async def generate_embeddings(text):
return {"embeddings": model.encode(text).tolist()}
|