Spaces:
Running
on
Zero
Running
on
Zero
Anton Bushuiev
commited on
Commit
·
4baed9c
1
Parent(s):
470975c
wrap back only forward
Browse files
app.py
CHANGED
@@ -1,22 +1,16 @@
|
|
1 |
-
print("""
|
2 |
-
|
3 |
-
| \/ | / \ |_ _| \ | |_ _| ____| \ | | / \ | \ | |/ ___| ____|
|
4 |
-
| |\/| | / _ \ | || \| | | | | _| | \| | / _ \ | \| | | | _|
|
5 |
-
| | | |/ ___ \ | || |\ | | | | |___| |\ |/ ___ \| |\ | |___| |___
|
6 |
-
|_| |_/_/ \_\___|_| \_| |_| |_____|_| \_/_/ \_\_| \_|\____|_____|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
Dear users, we are currently adapting the PPIformer Web for the GPU-based predictions.
|
16 |
-
Stay tuned for the much faster version of the web application!
|
17 |
-
|
18 |
-
The new verison of the web will be available withing several days.
|
19 |
-
""")
|
20 |
|
21 |
import sys
|
22 |
import copy
|
@@ -45,8 +39,7 @@ from ppiref.utils.ppi import PPIPath
|
|
45 |
from ppiref.utils.residue import Residue
|
46 |
from ppiformer.tasks.node import DDGPPIformer
|
47 |
from ppiformer.utils.api import download_weights
|
48 |
-
|
49 |
-
from ppiformer.utils.api import predict_ddg
|
50 |
from ppiformer.utils.torch import fill_diagonal
|
51 |
from ppiformer.definitions import PPIFORMER_WEIGHTS_DIR
|
52 |
|
@@ -60,14 +53,14 @@ logging.basicConfig(
|
|
60 |
random.seed(0)
|
61 |
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
|
73 |
def process_inputs(inputs, temp_dir):
|
@@ -288,7 +281,6 @@ def plot_3dmol(pdb_path, ppi_path, mut, attn, attn_mut_id=0):
|
|
288 |
allowpaymentrequest="" frameborder="0" srcdoc='{html}'></iframe>"""
|
289 |
|
290 |
|
291 |
-
@spaces.GPU
|
292 |
def predict(models, temp_dir, *inputs):
|
293 |
logging.info('Starting prediction')
|
294 |
|
|
|
1 |
+
# print("""
|
2 |
+
# __ __ _ ___ _ _ _____ _____ _ _ _ _ _ ____ _____
|
3 |
+
# | \/ | / \ |_ _| \ | |_ _| ____| \ | | / \ | \ | |/ ___| ____|
|
4 |
+
# | |\/| | / _ \ | || \| | | | | _| | \| | / _ \ | \| | | | _|
|
5 |
+
# | | | |/ ___ \ | || |\ | | | | |___| |\ |/ ___ \| |\ | |___| |___
|
6 |
+
# |_| |_/_/ \_\___|_| \_| |_| |_____|_| \_/_/ \_\_| \_|\____|_____|
|
7 |
|
8 |
+
# ____ ____ _____ _ _ __
|
9 |
+
# | __ )| _ \| ____| / \ | |/ /
|
10 |
+
# | _ \| |_) | _| / _ \ | ' /
|
11 |
+
# | |_) | _ <| |___ / ___ \| . \
|
12 |
+
# |____/|_| \_\_____/_/ \_\_|\_\
|
13 |
+
# """)
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
import sys
|
16 |
import copy
|
|
|
39 |
from ppiref.utils.residue import Residue
|
40 |
from ppiformer.tasks.node import DDGPPIformer
|
41 |
from ppiformer.utils.api import download_weights
|
42 |
+
from ppiformer.utils.api import predict_ddg as predict_ddg_
|
|
|
43 |
from ppiformer.utils.torch import fill_diagonal
|
44 |
from ppiformer.definitions import PPIFORMER_WEIGHTS_DIR
|
45 |
|
|
|
53 |
random.seed(0)
|
54 |
|
55 |
|
56 |
+
@spaces.GPU
|
57 |
+
def predict_ddg(models, ppi, muts, return_attn):
|
58 |
+
if return_attn:
|
59 |
+
ddg_pred, attns = predict_ddg_(models, ppi, muts, return_attn=return_attn)
|
60 |
+
return ddg_pred.detach().cpu(), attns.detach().cpu()
|
61 |
+
else:
|
62 |
+
ddg_pred = predict_ddg_(models, ppi, muts, return_attn=return_attn)
|
63 |
+
return ddg_pred.detach().cpu()
|
64 |
|
65 |
|
66 |
def process_inputs(inputs, temp_dir):
|
|
|
281 |
allowpaymentrequest="" frameborder="0" srcdoc='{html}'></iframe>"""
|
282 |
|
283 |
|
|
|
284 |
def predict(models, temp_dir, *inputs):
|
285 |
logging.info('Starting prediction')
|
286 |
|