education-webapp / main.py
anmolmalik01's picture
M
1b6f001
raw
history blame contribute delete
558 Bytes
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")