File size: 431 Bytes
1750478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)