Spaces:
Paused
Paused
Update chemietoolkit/interface.py
Browse files- chemietoolkit/interface.py +0 -22
chemietoolkit/interface.py
CHANGED
|
@@ -7,7 +7,6 @@ from PIL import Image
|
|
| 7 |
from huggingface_hub import hf_hub_download, snapshot_download
|
| 8 |
from molscribe import MolScribe
|
| 9 |
from rxnscribe import RxnScribe, MolDetect
|
| 10 |
-
from chemiener import ChemNER
|
| 11 |
from .tableextractor import TableExtractor
|
| 12 |
from .utils import *
|
| 13 |
|
|
@@ -22,7 +21,6 @@ class ChemIEToolkit:
|
|
| 22 |
self._rxnscribe = None
|
| 23 |
self._pdfparser = None
|
| 24 |
self._moldet = None
|
| 25 |
-
self._chemner = None
|
| 26 |
self._coref = None
|
| 27 |
|
| 28 |
@property
|
|
@@ -115,26 +113,6 @@ class ChemIEToolkit:
|
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
@property
|
| 122 |
-
def chemner(self):
|
| 123 |
-
if self._chemner is None:
|
| 124 |
-
self.init_chemner()
|
| 125 |
-
return self._chemner
|
| 126 |
-
|
| 127 |
-
@lru_cache(maxsize=None)
|
| 128 |
-
def init_chemner(self, ckpt_path=None):
|
| 129 |
-
"""
|
| 130 |
-
Set model to custom checkpoint
|
| 131 |
-
Parameters:
|
| 132 |
-
ckpt_path: path to checkpoint to use, if None then will use default
|
| 133 |
-
"""
|
| 134 |
-
if ckpt_path is None:
|
| 135 |
-
ckpt_path = hf_hub_download("Ozymandias314/ChemNERckpt", "best.ckpt")
|
| 136 |
-
self._chemner = ChemNER(ckpt_path, device=self.device)
|
| 137 |
-
|
| 138 |
|
| 139 |
@property
|
| 140 |
def tableextractor(self):
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download, snapshot_download
|
| 8 |
from molscribe import MolScribe
|
| 9 |
from rxnscribe import RxnScribe, MolDetect
|
|
|
|
| 10 |
from .tableextractor import TableExtractor
|
| 11 |
from .utils import *
|
| 12 |
|
|
|
|
| 21 |
self._rxnscribe = None
|
| 22 |
self._pdfparser = None
|
| 23 |
self._moldet = None
|
|
|
|
| 24 |
self._coref = None
|
| 25 |
|
| 26 |
@property
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
@property
|
| 118 |
def tableextractor(self):
|