sarim commited on
Commit
77753ce
·
1 Parent(s): 44027f1

initial commit

Browse files
Files changed (3) hide show
  1. Dockerfile +14 -0
  2. main.py +15 -0
  3. requirements.txt +7 -0
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ WORKDIR /code
7
+
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+ COPY . .
13
+
14
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Union
2
+
3
+ from fastapi import FastAPI
4
+
5
+ app = FastAPI()
6
+
7
+
8
+ @app.get("/")
9
+ def read_root():
10
+ return {"Hello": "World"}
11
+
12
+
13
+ @app.get("/items/{item_id}")
14
+ def read_item(item_id: int, q: Union[str, None] = None):
15
+ return {"item_id": item_id, "q": q}
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fastapi==0.74.*
2
+ requests==2.27.*
3
+ uvicorn[standard]==0.17.*
4
+ sentencepiece==0.1.*
5
+ torch==1.11.*
6
+ transformers[vision]==4.*
7
+ python-multipart==0.0.6