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('/app/jina', trust_remote_code=True) | |
app = FastAPI() | |
class Validation(BaseModel): | |
prompt: List[str] | |
#Endpoint | |
async def generate_embeddings(text): | |
return {"embeddings": model.encode(text).tolist()} | |