Spaces:
Sleeping
Sleeping
Tonic commited on
try hard with api
Browse files- .gitignore +2 -0
- app.py +5 -2
- requirements.txt +2 -1
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
venv/
|
| 2 |
+
.env
|
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import io
|
|
| 4 |
import numpy as np
|
| 5 |
import os
|
| 6 |
import traceback
|
| 7 |
-
import spaces
|
| 8 |
from esm.sdk import client
|
| 9 |
from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig
|
| 10 |
from esm.utils.structure.protein_chain import ProteinChain
|
|
@@ -13,6 +13,9 @@ import biotite.structure as bs
|
|
| 13 |
from biotite.structure.io import pdb
|
| 14 |
from esm.utils import residue_constants as RC
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
# Initialize the model
|
| 17 |
token = os.environ.get("ESM_API_TOKEN")
|
| 18 |
if not token:
|
|
@@ -165,7 +168,7 @@ def visualize_after_pred(protein: ESMProtein, aligned: ESMProtein):
|
|
| 165 |
view.zoomTo()
|
| 166 |
return view
|
| 167 |
|
| 168 |
-
@spaces.GPU()
|
| 169 |
def run_prediction(pdb_file, num_runs, noise_level, num_frames):
|
| 170 |
try:
|
| 171 |
if pdb_file is None:
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
import os
|
| 6 |
import traceback
|
| 7 |
+
# import spaces
|
| 8 |
from esm.sdk import client
|
| 9 |
from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig
|
| 10 |
from esm.utils.structure.protein_chain import ProteinChain
|
|
|
|
| 13 |
from biotite.structure.io import pdb
|
| 14 |
from esm.utils import residue_constants as RC
|
| 15 |
|
| 16 |
+
from dotenv import load_dotenv
|
| 17 |
+
|
| 18 |
+
load_dotenv()
|
| 19 |
# Initialize the model
|
| 20 |
token = os.environ.get("ESM_API_TOKEN")
|
| 21 |
if not token:
|
|
|
|
| 168 |
view.zoomTo()
|
| 169 |
return view
|
| 170 |
|
| 171 |
+
# @spaces.GPU()
|
| 172 |
def run_prediction(pdb_file, num_runs, noise_level, num_frames):
|
| 173 |
try:
|
| 174 |
if pdb_file is None:
|
requirements.txt
CHANGED
|
@@ -7,4 +7,5 @@ pandas
|
|
| 7 |
torch
|
| 8 |
numpy
|
| 9 |
esm
|
| 10 |
-
biotite
|
|
|
|
|
|
| 7 |
torch
|
| 8 |
numpy
|
| 9 |
esm
|
| 10 |
+
biotite
|
| 11 |
+
python-dotenv
|