File size: 933 Bytes
6e9ce07
849a486
 
 
 
97fb172
6e9ce07
 
849a486
 
7d1c4ec
3175b6a
7d1c4ec
849a486
 
 
 
 
 
 
 
6e9ce07
849a486
982bfac
97fb172
9fd7f10
97fb172
9fd7f10
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)