Spaces:
No application file
No application file
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_huggingface.embeddings import HuggingFaceEmbeddings
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
from typing import Union
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
|
| 7 |
+
@app.get("/")
|
| 8 |
+
def read_root():
|
| 9 |
+
return {"Hello": "World"}
|
| 10 |
+
|
| 11 |
+
@app.get("/embeddings")
|
| 12 |
+
def read_item():
|
| 13 |
+
embeddings = HuggingFaceEmbeddings()
|
| 14 |
+
return embeddings
|
| 15 |
+
|
| 16 |
+
@app.get("/test/{text}")
|
| 17 |
+
def read_item(text):
|
| 18 |
+
embeddings = HuggingFaceEmbeddings()
|
| 19 |
+
return embeddings.embed_query(text)
|