beeguy commited on
Commit
3426e6e
·
1 Parent(s): 27d375b

triying embeddings

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. app.py +12 -0
  3. 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.9
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