mars9801 commited on
Commit
6cc5c6d
1 Parent(s): 4c37112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -1,23 +1,23 @@
1
- from fastapi import FastAPI
2
- from transfomers import pipeline
3
-
4
-
5
- #creating a FASTAPI app instance
6
- app= FastAPI()
7
-
8
- #
9
- pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
-
11
- @app.get("/")
12
- def home():
13
- return{"message":"Hello there , How are you ?"}
14
-
15
-
16
-
17
- @app.get("/generate")
18
- def generate(text:str):
19
- ##use pipeline to generate text from given input text
20
- output = pipe(text)
21
-
22
- #return the generate text in Json
23
  return{'output':output[0]['generated_text']}
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+
5
+ #creating a FASTAPI app instance
6
+ app= FastAPI()
7
+
8
+ #
9
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
+
11
+ @app.get("/")
12
+ def home():
13
+ return{"message":"Hello there , How are you ?"}
14
+
15
+
16
+
17
+ @app.get("/generate")
18
+ def generate(text:str):
19
+ ##use pipeline to generate text from given input text
20
+ output = pipe(text)
21
+
22
+ #return the generate text in Json
23
  return{'output':output[0]['generated_text']}