andreaschandra commited on
Commit
4ceee4a
·
1 Parent(s): a97bf7c

add docker

Browse files
Files changed (4) hide show
  1. README.md +6 -0
  2. app_docker.py +7 -0
  3. dockerfile +15 -0
  4. requirements.txt +5 -1
README.md CHANGED
@@ -24,4 +24,10 @@ Using streamlit
24
  ```
25
  sdk: streamlit
26
  sdk_version: 1.41.0
 
 
 
 
 
 
27
  ```
 
24
  ```
25
  sdk: streamlit
26
  sdk_version: 1.41.0
27
+ ```
28
+
29
+ Using docker
30
+ ```
31
+ sdk: docker
32
+ app_port: 7860
33
  ```
app_docker.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI()
4
+
5
+
6
+ def read_root():
7
+ return {"Hello": "World!"}
dockerfile ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # The two following lines are requirements for the Dev Mode to be functional
7
+ # Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
8
+ RUN useradd -m -u 1000 user
9
+ WORKDIR /app
10
+
11
+ COPY --chown=user ./requirements.txt requirements.txt
12
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
+
14
+ COPY --chown=user . /app
15
+ CMD ["uvicorn", "app_docker:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -1,2 +1,6 @@
1
  transformers
2
- torch
 
 
 
 
 
1
  transformers
2
+ torch
3
+ fastapi==0.74.*
4
+ requests==2.27.*
5
+ sentencepiece==0.1.*
6
+ uvicorn[standard]==0.17.*