wdh99 commited on
Commit
1cfb21c
1 Parent(s): 9913d6f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -2
main.py CHANGED
@@ -1,7 +1,24 @@
1
  from fastapi import FastAPI
 
 
2
 
3
  app = FastAPI()
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  @app.get("/")
6
- def read_root():
7
- return {"Hello": "World!"}
 
1
  from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
 
5
  app = FastAPI()
6
 
7
+ # @app.get("/")
8
+ # def read_root():
9
+ # return {"Hello": "World!"}
10
+
11
+
12
+ pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
13
+
14
+ @app.get("/infer_t5")
15
+ def t5(input):
16
+ output = pipe_flan(input)
17
+ return {"output": output[0]["generated_text"]}
18
+
19
+
20
+ app.mount("/", StaticFiles(directory="static", html=True), name="static")
21
+
22
  @app.get("/")
23
+ def index() -> FileResponse:
24
+ return FileResponse(path="/app/static/index.html", media_type="text/html")