MudassirFayaz commited on
Commit
47246fc
1 Parent(s): 4c6c748

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -4,4 +4,23 @@ app = FastAPI()
4
 
5
  @app.get("/")
6
  def greet_json():
7
- return {"Hello": "World!"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  @app.get("/")
6
  def greet_json():
7
+ return {"status": "Its working built by Fayaz"}
8
+
9
+ # Initialize the text generation pipeline
10
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
11
+
12
+
13
+ @app.get("/")
14
+ def home():
15
+ return {"message":"Hello World"}
16
+
17
+ # Define a function to handle the GET request at `/generate`
18
+
19
+
20
+ @app.get("/generate")
21
+ def generate(text:str):
22
+ ## use the pipeline to generate text from given input text
23
+ output=pipe(text)
24
+
25
+ ## return the generate text in Json reposne
26
+ return {"output":output[0]['generated_text']}