Spaces:
Running
on
Zero
Running
on
Zero
New viz
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ import warnings
|
|
| 16 |
from datetime import datetime
|
| 17 |
from pathlib import Path
|
| 18 |
BASE_DIR = Path(__file__).resolve().parent
|
| 19 |
-
LOCAL_COMPONENT_PATH = BASE_DIR / "
|
| 20 |
sys.path.insert(0, str(LOCAL_COMPONENT_PATH))
|
| 21 |
from gradio_molecule3d.molecule3d import Molecule3D
|
| 22 |
from Bio.PDB import PDBParser, PDBIO
|
|
@@ -269,14 +269,7 @@ def flex_3d(input_file):
|
|
| 269 |
|
| 270 |
model.to(config['inference_args']['device'])
|
| 271 |
print("Loading 3D model from {}".format(config['inference_args']['3d_model_path']))
|
| 272 |
-
|
| 273 |
-
file_weights = config['inference_args']['3d_model_path']
|
| 274 |
-
|
| 275 |
-
# Get path (instant if cached)
|
| 276 |
-
weights_path = get_weights_path(repo_id, file_weights)
|
| 277 |
-
|
| 278 |
-
# Load weights
|
| 279 |
-
state_dict = torch.load(weights_path, map_location=config['inference_args']['device'])
|
| 280 |
model.load_state_dict(state_dict, strict=False)
|
| 281 |
model.eval()
|
| 282 |
|
|
@@ -634,4 +627,4 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 634 |
predict_3d.click(handle_3d_prediction, inputs=[input_file_3d], outputs=[output_files, output_text, molecule_output])
|
| 635 |
|
| 636 |
# Launch the interface
|
| 637 |
-
demo.launch(show_error=True
|
|
|
|
| 16 |
from datetime import datetime
|
| 17 |
from pathlib import Path
|
| 18 |
BASE_DIR = Path(__file__).resolve().parent
|
| 19 |
+
LOCAL_COMPONENT_PATH = BASE_DIR / "gradio_molecule3d_2" / "backend"
|
| 20 |
sys.path.insert(0, str(LOCAL_COMPONENT_PATH))
|
| 21 |
from gradio_molecule3d.molecule3d import Molecule3D
|
| 22 |
from Bio.PDB import PDBParser, PDBIO
|
|
|
|
| 269 |
|
| 270 |
model.to(config['inference_args']['device'])
|
| 271 |
print("Loading 3D model from {}".format(config['inference_args']['3d_model_path']))
|
| 272 |
+
state_dict = torch.load(config['inference_args']['3d_model_path'], map_location=config['inference_args']['device'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
model.load_state_dict(state_dict, strict=False)
|
| 274 |
model.eval()
|
| 275 |
|
|
|
|
| 627 |
predict_3d.click(handle_3d_prediction, inputs=[input_file_3d], outputs=[output_files, output_text, molecule_output])
|
| 628 |
|
| 629 |
# Launch the interface
|
| 630 |
+
demo.launch(show_error=True)
|