Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -41,19 +41,16 @@ MODEL_PROP_DESCRIPTION = {
|
|
| 41 |
|
| 42 |
|
| 43 |
def main(property: str, smiles: str, smiles_file: str):
|
| 44 |
-
|
| 45 |
if "Molformer" in property:
|
| 46 |
version = property.split(" ")[-1].split("(")[-1].split(")")[0]
|
| 47 |
property = property.split(" ")[0]
|
| 48 |
-
print(property, version)
|
| 49 |
algo, config = MOLECULE_PROPERTY_PREDICTOR_FACTORY[property.lower()]
|
| 50 |
kwargs = (
|
| 51 |
{"algorithm_version": "v0"} if property in MODEL_PROP_DESCRIPTION.keys() else {}
|
| 52 |
)
|
| 53 |
if property.lower() in MOLFORMER_VERSIONS.keys():
|
| 54 |
kwargs["algorithm_version"] = version
|
| 55 |
-
|
| 56 |
-
print("KWARGS", kwargs)
|
| 57 |
model = algo(config(**kwargs))
|
| 58 |
if smiles is not None and smiles_file is not None:
|
| 59 |
raise ValueError("Pass either smiles or smiles_file, not both.")
|
|
@@ -78,7 +75,6 @@ def main(property: str, smiles: str, smiles_file: str):
|
|
| 78 |
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
-
|
| 82 |
# Preparation (retrieve all available algorithms)
|
| 83 |
properties = list(MOLECULE_PROPERTY_PREDICTOR_FACTORY.keys())[::-1]
|
| 84 |
for prop in REMOVE:
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
def main(property: str, smiles: str, smiles_file: str):
|
|
|
|
| 44 |
if "Molformer" in property:
|
| 45 |
version = property.split(" ")[-1].split("(")[-1].split(")")[0]
|
| 46 |
property = property.split(" ")[0]
|
|
|
|
| 47 |
algo, config = MOLECULE_PROPERTY_PREDICTOR_FACTORY[property.lower()]
|
| 48 |
kwargs = (
|
| 49 |
{"algorithm_version": "v0"} if property in MODEL_PROP_DESCRIPTION.keys() else {}
|
| 50 |
)
|
| 51 |
if property.lower() in MOLFORMER_VERSIONS.keys():
|
| 52 |
kwargs["algorithm_version"] = version
|
| 53 |
+
|
|
|
|
| 54 |
model = algo(config(**kwargs))
|
| 55 |
if smiles is not None and smiles_file is not None:
|
| 56 |
raise ValueError("Pass either smiles or smiles_file, not both.")
|
|
|
|
| 75 |
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
|
|
|
| 78 |
# Preparation (retrieve all available algorithms)
|
| 79 |
properties = list(MOLECULE_PROPERTY_PREDICTOR_FACTORY.keys())[::-1]
|
| 80 |
for prop in REMOVE:
|
utils.py
CHANGED
|
@@ -24,6 +24,7 @@ def draw_grid_predict(
|
|
| 24 |
Returns:
|
| 25 |
HTML to display
|
| 26 |
"""
|
|
|
|
| 27 |
|
| 28 |
if domain not in ["Molecules", "Proteins"]:
|
| 29 |
raise ValueError(f"Unsupported domain {domain}")
|
|
|
|
| 24 |
Returns:
|
| 25 |
HTML to display
|
| 26 |
"""
|
| 27 |
+
print("Mols2Grid", mols2grid.__version__)
|
| 28 |
|
| 29 |
if domain not in ["Molecules", "Proteins"]:
|
| 30 |
raise ValueError(f"Unsupported domain {domain}")
|