faizanmumtaz commited on
Commit
1750478
1 Parent(s): a7c2aed

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
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)