Spaces:
Runtime error
Runtime error
Topallaj Denis
commited on
Commit
·
fd0eebc
1
Parent(s):
365c9e4
refactor implementation html
Browse files
main.py
CHANGED
@@ -25,6 +25,8 @@ app.add_middleware(
|
|
25 |
allow_headers=["*"]
|
26 |
)
|
27 |
|
|
|
|
|
28 |
tokenizer = T5Tokenizer.from_pretrained(
|
29 |
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
30 |
|
@@ -35,12 +37,9 @@ class Item(pydantic.BaseModel):
|
|
35 |
sequence: str
|
36 |
smiles: str
|
37 |
|
38 |
-
|
39 |
-
app.mount("/", StaticFiles(directory="static"), name="static")
|
40 |
-
|
41 |
@app.get("/")
|
42 |
-
def
|
43 |
-
return FileResponse("index.html")
|
44 |
|
45 |
@app.post("/predict")
|
46 |
def predict(item: Item):
|
|
|
25 |
allow_headers=["*"]
|
26 |
)
|
27 |
|
28 |
+
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
29 |
+
|
30 |
tokenizer = T5Tokenizer.from_pretrained(
|
31 |
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
32 |
|
|
|
37 |
sequence: str
|
38 |
smiles: str
|
39 |
|
|
|
|
|
|
|
40 |
@app.get("/")
|
41 |
+
def index() -> FileResponse:
|
42 |
+
return FileResponse(path="/app/static/index.html", media_type="text/html")
|
43 |
|
44 |
@app.post("/predict")
|
45 |
def predict(item: Item):
|