Spaces:
Running
on
Zero
Running
on
Zero
Upload 5 files
Browse files- app.py +3 -2
- model/barlow_twins.py +3 -1
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import plotly.graph_objects as go
|
|
| 3 |
import numpy as np
|
| 4 |
import pandas as pd
|
| 5 |
from model.model import DTIModel
|
| 6 |
-
|
| 7 |
|
| 8 |
dt_str = "14062024_0910"
|
| 9 |
|
|
@@ -31,6 +31,7 @@ def make_spider_plot(predictions, model_names, smiles_list):
|
|
| 31 |
return fig
|
| 32 |
|
| 33 |
|
|
|
|
| 34 |
def predict_and_plot(amino_acid_sequence, smiles_input, datasets):
|
| 35 |
model_ensemble = {}
|
| 36 |
|
|
@@ -128,4 +129,4 @@ iface = gr.Interface(
|
|
| 128 |
theme=theme
|
| 129 |
)
|
| 130 |
|
| 131 |
-
iface.launch(
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import pandas as pd
|
| 5 |
from model.model import DTIModel
|
| 6 |
+
import spaces
|
| 7 |
|
| 8 |
dt_str = "14062024_0910"
|
| 9 |
|
|
|
|
| 31 |
return fig
|
| 32 |
|
| 33 |
|
| 34 |
+
@spaces.GPU
|
| 35 |
def predict_and_plot(amino_acid_sequence, smiles_input, datasets):
|
| 36 |
model_ensemble = {}
|
| 37 |
|
|
|
|
| 129 |
theme=theme
|
| 130 |
)
|
| 131 |
|
| 132 |
+
iface.launch()
|
model/barlow_twins.py
CHANGED
|
@@ -485,6 +485,7 @@ class BarlowTwins(BaseModel):
|
|
| 485 |
if self.param_dict["verbose"] is True:
|
| 486 |
print(f"[BT]: Model saved at {folder_path}")
|
| 487 |
|
|
|
|
| 488 |
def load_model(self, path: str) -> None:
|
| 489 |
# make weights, config and history paths
|
| 490 |
weights_path = path + "/weights.pt"
|
|
@@ -519,7 +520,8 @@ class BarlowTwins(BaseModel):
|
|
| 519 |
print(f"[BT]: Model loaded from {path}")
|
| 520 |
print("[BT]: Loaded parameters:")
|
| 521 |
print(self.param_dict)
|
| 522 |
-
|
|
|
|
| 523 |
def move_to_device(self, device) -> None:
|
| 524 |
# move each Sequential model to device
|
| 525 |
self.enc_mol.to(device)
|
|
|
|
| 485 |
if self.param_dict["verbose"] is True:
|
| 486 |
print(f"[BT]: Model saved at {folder_path}")
|
| 487 |
|
| 488 |
+
@spaces.GPU
|
| 489 |
def load_model(self, path: str) -> None:
|
| 490 |
# make weights, config and history paths
|
| 491 |
weights_path = path + "/weights.pt"
|
|
|
|
| 520 |
print(f"[BT]: Model loaded from {path}")
|
| 521 |
print("[BT]: Loaded parameters:")
|
| 522 |
print(self.param_dict)
|
| 523 |
+
|
| 524 |
+
@spaces.GPU
|
| 525 |
def move_to_device(self, device) -> None:
|
| 526 |
# move each Sequential model to device
|
| 527 |
self.enc_mol.to(device)
|