Huhujingjing
commited on
Commit
•
0bd28fd
1
Parent(s):
27fdc8e
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- lisn519010/QM9
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
- zh
|
8 |
+
metrics:
|
9 |
+
- mae
|
10 |
+
- accuracy
|
11 |
+
- r_squared
|
12 |
+
- mse
|
13 |
+
pipeline_tag: graph-ml
|
14 |
+
---
|
15 |
+
|
16 |
+
```
|
17 |
+
pip install transformers gradio rdkit torch torch_scatter torch_sparse torch_geometric
|
18 |
+
```
|
19 |
+
|
20 |
+
```python
|
21 |
+
import gradio as gr
|
22 |
+
from transformers import AutoModel
|
23 |
+
|
24 |
+
def predict_smiles(name):
|
25 |
+
device = 'cpu'
|
26 |
+
smiles = name
|
27 |
+
assert isinstance(smiles, str), 'smiles must be str'
|
28 |
+
|
29 |
+
smiles = smiles.strip()
|
30 |
+
if ';' in smiles:
|
31 |
+
smiles = smiles.split(";")
|
32 |
+
elif ' ' in smiles:
|
33 |
+
smiles = smiles.split(" ")
|
34 |
+
elif ',' in smiles:
|
35 |
+
smiles = smiles.split(",")
|
36 |
+
else:
|
37 |
+
smiles = [smiles]
|
38 |
+
|
39 |
+
|
40 |
+
model = AutoModel.from_pretrained("Huhujingjing/custom-mxm", trust_remote_code=True).to(device)
|
41 |
+
|
42 |
+
output, df = model.predict_smiles(smiles)
|
43 |
+
|
44 |
+
return output, df
|
45 |
+
|
46 |
+
iface = gr.Interface(fn=predict_smiles, inputs="text", outputs=["text", "dataframe"])
|
47 |
+
iface.launch(share=True)
|
48 |
+
```
|