File size: 558 Bytes
4fd4592
53dc870
 
 
 
68e5d2d
03f7088
53dc870
 
 
 
 
 
 
 
 
4fd4592
53dc870
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from transformers import pipeline

app = FastAPI()

summarizer = pipeline("summarization", model="Falconsai/text_summarization")

@app.get("/prediction")
def pre(input):
    output = summarizer(input)
    print(output)
    return {"output": output[0]}

app.mount("/static", StaticFiles(directory="static"), name="static")

@app.get('/')
def index() -> FileResponse:
    return FileResponse(path='./static/static.html', media_type="text/html")