luanpoppe commited on
Commit
6590dbb
·
1 Parent(s): 2857fa0

initial commit

Browse files
Files changed (3) hide show
  1. Dockerfile +13 -0
  2. app.py +21 -0
  3. requirements.txt +9 -0
Dockerfile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import os
3
+
4
+ app = FastAPI()
5
+
6
+ @app.get("/")
7
+ def greet_json():
8
+ return {"Hello": "World!"}
9
+
10
+ @app.get("/hello")
11
+ def hello():
12
+ llm = HuggingFaceEndpoint(
13
+ repo_id="meta-llama/Meta-Llama-3-8B-Instruct",
14
+ task="text-generation",
15
+ max_new_tokens=100,
16
+ do_sample=False,
17
+ huggingfacehub_api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
18
+ )
19
+ result = llm.invoke("Hugging Face is")
20
+ print('result: ', result)
21
+ return (result)
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn[standard]
3
+ langchain
4
+ langchain-community
5
+ langchain-huggingface
6
+ # langchain-chroma
7
+ # langchain-core
8
+ # langchain-openai
9
+ # langchain-text-splitters