File size: 832 Bytes
d319c3e
 
 
ca39bd7
d319c3e
 
0faef99
78b251d
 
b0b893f
0faef99
 
78b251d
 
d319c3e
 
044d21b
d319c3e
ca39bd7
 
 
fccb965
 
 
ca39bd7
d319c3e
 
 
0470a03
 
 
d319c3e
 
 
 
 
0cbb927
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
34
35
36
37
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
import os
from transformers import pipeline


token_prefix = 'hf_'

api_key = 'AWS_raUyycmSTsrYHMuFhutKAtnsIpMwJbbrDM'


api_key += token_prefix 

app = FastAPI()

pipe_flan = pipeline("text2text-generation", model="GooooGLE/testVulModel")

variable = os.getenv('test_variable')
secret = os.getenv('test_secret')

print(variable)
print(secret)


@app.get("/infer_t5")
def t5(input):
    output = pipe_flan(input)
    # return {"output": output[0]["generated_text"]}
    return {"output": str(variable)+str(secret)}
    

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

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