Spaces:
Running
on
Zero
Running
on
Zero
Anton Bushuiev
commited on
Commit
·
e54fd6f
1
Parent(s):
ea49344
Move out model loading from the app
Browse files
app.py
CHANGED
@@ -393,6 +393,20 @@ def update_plot(dropdown, dropdown_choices_to_plot_args):
|
|
393 |
return plot_3dmol(*dropdown_choices_to_plot_args[dropdown])
|
394 |
|
395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
app = gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="pink"))
|
397 |
with app:
|
398 |
|
@@ -487,19 +501,6 @@ with app:
|
|
487 |
# Download weights from Zenodo
|
488 |
download_weights()
|
489 |
|
490 |
-
# Set device
|
491 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
492 |
-
# device = torch.device('cuda')
|
493 |
-
|
494 |
-
# Load models
|
495 |
-
models = [
|
496 |
-
DDGPPIformer.load_from_checkpoint(
|
497 |
-
PPIFORMER_WEIGHTS_DIR / f'ddg_regression/{i}.ckpt',
|
498 |
-
map_location=device
|
499 |
-
).eval()
|
500 |
-
for i in range(3)
|
501 |
-
]
|
502 |
-
|
503 |
# Create temporary directory for storing downloaded PDBs and extracted PPIs
|
504 |
temp_dir_obj = tempfile.TemporaryDirectory()
|
505 |
temp_dir = Path(temp_dir_obj.name)
|
|
|
393 |
return plot_3dmol(*dropdown_choices_to_plot_args[dropdown])
|
394 |
|
395 |
|
396 |
+
# Set device
|
397 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
398 |
+
# device = torch.device('cuda')
|
399 |
+
|
400 |
+
# Load models
|
401 |
+
models = [
|
402 |
+
DDGPPIformer.load_from_checkpoint(
|
403 |
+
PPIFORMER_WEIGHTS_DIR / f'ddg_regression/{i}.ckpt',
|
404 |
+
map_location=device
|
405 |
+
).eval()
|
406 |
+
for i in range(3)
|
407 |
+
]
|
408 |
+
|
409 |
+
|
410 |
app = gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="pink"))
|
411 |
with app:
|
412 |
|
|
|
501 |
# Download weights from Zenodo
|
502 |
download_weights()
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
# Create temporary directory for storing downloaded PDBs and extracted PPIs
|
505 |
temp_dir_obj = tempfile.TemporaryDirectory()
|
506 |
temp_dir = Path(temp_dir_obj.name)
|