qr_embd_api / app.py
MossaabDev's picture
init
083f6db
raw
history blame contribute delete
435 Bytes
from fastapi import FastAPI
from sentence_transformers import SentenceTransformer
app = FastAPI()
model = SentenceTransformer("MossaabDev/quran_shifaa")
@app.post("/embed")
async def embed(text: str):
emb = model.encode(text).tolist()
return {"embedding": emb}
# embed a list of texts
@app.post("/embed_batch")
async def embed_batch(texts: list[str]):
embs = model.encode(texts).tolist()
return {"embeddings": embs}