Nocare3 commited on
Commit
bfa9d6f
·
verified ·
1 Parent(s): 81c50b4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -2
main.py CHANGED
@@ -1,7 +1,18 @@
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
  app = FastAPI()
5
 
6
+ app.mount("/", StaticFiles(directory="static", html=True), name="static")
7
+
8
  @app.get("/")
9
+ def index() -> FileResponse:
10
+ return FileResponse(path="/app/static/index.html", media_type="text/html")
11
+
12
+
13
+ pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
14
+
15
+ @app.get("infer_t5")
16
+ def t5(input):
17
+ output = pipe_flan(input)
18
+ return {"output": output[0]["generated_text"]}