InnoLink's picture
Rename app.py to src/app.py
982bfac verified
raw
history blame contribute delete
933 Bytes
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from transformers import pipeline
#from datasets import load_dataset
app = FastAPI()
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
#Inference Augmentation: Load a dataset like SQuAD for question-answering;
#to generate responses, testing zero-shot capabilities
@app.get("/infer_t5")
def t5(input):
output = pipe_flan(input)
return {"output": output[0]["generated_text"]}
app.mount("/", StaticFiles(directory="static", html=True), name="static")
@app.get("/")
def index() -> FileResponse:
return FileResponse(path="/static/index.html", media_type="text/html")
## line-6
#dataset = load_dataset('glue', 'mrpc')
#In app.py, define models/endpoints for /signup
#(hash passwords with bcrypt—add bcrypt==4.2.0),
#/login (JWT auth via fastapi-jwt-auth or built-in)