Update main.py
Browse files
main.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
-
from
|
|
|
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")
|
@@ -16,7 +13,6 @@ 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("/")
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.staticfiles import StaticFiles
|
3 |
+
from fastapi.responses import FileResponse
|
4 |
|
5 |
+
from transformers import pipeline
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
10 |
|
11 |
@app.get("/infer_t5")
|
|
|
13 |
output = pipe_flan(input)
|
14 |
return {"output": output[0]["generated_text"]}
|
15 |
|
|
|
16 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
17 |
|
18 |
@app.get("/")
|