Teja990 commited on
Commit
854b4dc
·
verified ·
1 Parent(s): 9cfcf91

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+ app=FastAPI()
5
+
6
+ pipe=pipeline("text2text-generation", model="google/flan-t5-small")
7
+
8
+ @app.get("/")
9
+ def home():
10
+ return {"message":"Hello World"}
11
+
12
+
13
+ @app.get("/generate")
14
+ def generate(text:str):
15
+ output=pipe(text)
16
+
17
+ return {"output":output[0]['generated_text']}