rohitjakkam commited on
Commit
1d1b1f9
·
verified ·
1 Parent(s): e5e9e52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -1,20 +1,20 @@
1
- from fastapi import FastAPI
2
- from transformers import pipleline
3
-
4
- # create a new FASTAPI app instance
5
- app = Fastapi()
6
-
7
- # Initialize the text generation pipleline
8
- pipe = pipeline("text2text-generation", model="google/flan-t5-small")
9
-
10
- @app.get("/")
11
- def home():
12
- return {"message": "Welcome to the Text Generation API"}
13
-
14
- @app.get("/generate")
15
- def generate(text:str):
16
- # use pipelibe to generate text from given text as input param
17
- output = pipe(text)
18
-
19
- # return the generated text in Json response
20
  return {"output":output[0]['generated_text']}
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+ # create a new FASTAPI app instance
5
+ app = Fastapi()
6
+
7
+ # Initialize the text generation pipleline
8
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
9
+
10
+ @app.get("/")
11
+ def home():
12
+ return {"message": "Welcome to the Text Generation API"}
13
+
14
+ @app.get("/generate")
15
+ def generate(text:str):
16
+ # use pipelibe to generate text from given text as input param
17
+ output = pipe(text)
18
+
19
+ # return the generated text in Json response
20
  return {"output":output[0]['generated_text']}