caobencheng commited on
Commit
79e4992
·
verified ·
1 Parent(s): 236f46e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -1
main.py CHANGED
@@ -4,4 +4,13 @@ app = FastAPI()
4
 
5
  @app.get("/")
6
  def read_root():
7
- return {"Hello": "World!"}
 
 
 
 
 
 
 
 
 
 
4
 
5
  @app.get("/")
6
  def read_root():
7
+ return {"Hello": "World!"}
8
+
9
+ from transformers import pipeline
10
+
11
+ pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
12
+
13
+ @app.get("/infer_t5")
14
+ def t5(input):
15
+ output = pipe_flan(input)
16
+ return {"output": output[0]["generated_text"]}