Spaces:
Runtime error
Runtime error
Topallaj Denis
commited on
Commit
·
ef19c0b
1
Parent(s):
6caf496
test
Browse files
main.py
CHANGED
|
@@ -18,12 +18,13 @@ import pydantic
|
|
| 18 |
app = FastAPI()
|
| 19 |
|
| 20 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 21 |
-
|
| 22 |
tokenizer = T5Tokenizer.from_pretrained(
|
| 23 |
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
| 24 |
|
| 25 |
model = T5EncoderModel.from_pretrained(
|
| 26 |
"Rostlab/prot_t5_xl_half_uniref50-enc")
|
|
|
|
| 27 |
|
| 28 |
class Item(pydantic.BaseModel):
|
| 29 |
sequence: str
|
|
@@ -35,6 +36,18 @@ def index() -> FileResponse:
|
|
| 35 |
|
| 36 |
@app.post("/predict")
|
| 37 |
def predict(item: Item):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
endpointHandler = EndpointHandler()
|
| 39 |
result = endpointHandler.predict({
|
| 40 |
"inputs": {
|
|
@@ -42,6 +55,7 @@ def predict(item: Item):
|
|
| 42 |
"smiles": item.smiles
|
| 43 |
}
|
| 44 |
})
|
|
|
|
| 45 |
|
| 46 |
return result
|
| 47 |
|
|
|
|
| 18 |
app = FastAPI()
|
| 19 |
|
| 20 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
| 21 |
+
"""
|
| 22 |
tokenizer = T5Tokenizer.from_pretrained(
|
| 23 |
"Rostlab/prot_t5_xl_half_uniref50-enc", do_lower_case=False, torch_dtype=torch.float16)
|
| 24 |
|
| 25 |
model = T5EncoderModel.from_pretrained(
|
| 26 |
"Rostlab/prot_t5_xl_half_uniref50-enc")
|
| 27 |
+
"""
|
| 28 |
|
| 29 |
class Item(pydantic.BaseModel):
|
| 30 |
sequence: str
|
|
|
|
| 36 |
|
| 37 |
@app.post("/predict")
|
| 38 |
def predict(item: Item):
|
| 39 |
+
|
| 40 |
+
sequence = item.sequence
|
| 41 |
+
smiles = item.smiles
|
| 42 |
+
|
| 43 |
+
result = {
|
| 44 |
+
"Km": 0.0,
|
| 45 |
+
"Kcat": 0.0,
|
| 46 |
+
"Vmax": 0.0
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
"""
|
| 51 |
endpointHandler = EndpointHandler()
|
| 52 |
result = endpointHandler.predict({
|
| 53 |
"inputs": {
|
|
|
|
| 55 |
"smiles": item.smiles
|
| 56 |
}
|
| 57 |
})
|
| 58 |
+
"""
|
| 59 |
|
| 60 |
return result
|
| 61 |
|