Spaces:
Sleeping
Sleeping
triying embeddings
Browse files- Dockerfile +1 -1
- app.py +12 -0
- requirements.txt +1 -0
Dockerfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
-
FROM python:3.
|
5 |
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
+
FROM python:3.12.3
|
5 |
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
app.py
CHANGED
@@ -1,9 +1,21 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from os import getenv
|
|
|
3 |
|
4 |
app = FastAPI()
|
5 |
MY_KEY = getenv("MY_KEY")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
@app.get("/")
|
8 |
def greet_json():
|
9 |
return {"Hello": "World! My key is: " + MY_KEY}
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from os import getenv
|
3 |
+
from langchain_huggingface import HuggingFaceEmbeddings
|
4 |
|
5 |
app = FastAPI()
|
6 |
MY_KEY = getenv("MY_KEY")
|
7 |
|
8 |
+
embeddings = HuggingFaceEmbeddings(model_name="jinaai/jina-embeddings-v2-small-en")
|
9 |
+
|
10 |
+
|
11 |
+
@app.get("/embeddings")
|
12 |
+
def get_embeddings():
|
13 |
+
test = embeddings.embed_query("Hello, world!")
|
14 |
+
return {
|
15 |
+
"embeddings": "This is the embeddings endpoint",
|
16 |
+
"test": test
|
17 |
+
}
|
18 |
+
|
19 |
@app.get("/")
|
20 |
def greet_json():
|
21 |
return {"Hello": "World! My key is: " + MY_KEY}
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
fastapi
|
2 |
uvicorn[standard]
|
|
|
3 |
|
|
|
1 |
fastapi
|
2 |
uvicorn[standard]
|
3 |
+
langchain-huggingface
|
4 |
|