Tushar1K commited on
Commit
4e2b5d0
·
verified ·
1 Parent(s): 351302f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -1,18 +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']}
 
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]['generated_text']}