Tushar1K commited on
Commit
ebade92
1 Parent(s): 87b9830

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +0 -0
  2. app.py +18 -0
  3. requirements.txt +6 -0
Dockerfile ADDED
File without changes
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+ ##create new fast api app instance
5
+ app=FastAPI()
6
+
7
+ #initialize the text genration pipeline
8
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
9
+
10
+ @app.get("/")
11
+ def home():
12
+ return {"message":"Hello World"}
13
+
14
+
15
+ @app.get("/generate")
16
+ def generate(text:str):
17
+ output=pipe(text)
18
+ return{"output":output[0]['generate_text']}
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastapi==0.74.*
2
+ requests==2.27.*
3
+ uvicorn[standard]==0.17.*
4
+ torch==1.11.*
5
+ transformers==4.*
6
+ sentencepiece==0.1.*