embeddings / app.py
faizanmumtaz's picture
Upload app.py
1750478 verified
raw
history blame contribute delete
431 Bytes
from langchain_huggingface.embeddings import HuggingFaceEmbeddings
from fastapi import FastAPI
from typing import Union
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/embeddings")
def read_item():
embeddings = HuggingFaceEmbeddings()
return embeddings
@app.get("/test/{text}")
def read_item(text):
embeddings = HuggingFaceEmbeddings()
return embeddings.embed_query(text)