sidpawar commited on
Commit
d59a9ec
·
verified ·
1 Parent(s): 6b028d5

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +20 -0
  2. app.py +16 -0
  3. requirements.txt +6 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
+
9
+ RUN useradd sid
10
+
11
+ USER sid
12
+
13
+ ENV HOME=/home/sid \
14
+ PATH=/home/sid/.local/bin:$PATH
15
+
16
+ WORKDIR $HOME/app
17
+
18
+ COPY --chown=sid . $HOME/app
19
+
20
+ CMD [ "uvicorn", "app:app", "--host", "0.0.0.0","--port","7860" ]
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from fastapi import FastAPI
3
+ from transformers import pipeline
4
+
5
+
6
+ app = FastAPI()
7
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
8
+
9
+ @app.get("/")
10
+ def home():
11
+ return{"message":"hello siddhant"}
12
+
13
+ @app.get("/genrate")
14
+ def gentxt(text : str):
15
+ output = pipe(text)
16
+ return({"output":output[0]["generated_text"]})
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastapi==0.74.*
2
+ requests==2.27.*
3
+ uvicorn[standard]==0.17.*
4
+ sentencepiece==0.1.*
5
+ torch==1.11.*
6
+ transformers==4.*