liuganghuggingface
commited on
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -3,17 +3,18 @@ import gradio as gr
|
|
3 |
import torch
|
4 |
from rdkit import Chem
|
5 |
from rdkit.Chem import Draw
|
6 |
-
from graph_decoder.diffusion_model import GraphDiT
|
7 |
|
8 |
# Load the model
|
9 |
def load_graph_decoder(path='model_labeled'):
|
10 |
-
model = GraphDiT(
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
)
|
15 |
-
model.init_model(path)
|
16 |
-
model.disable_grads()
|
|
|
17 |
return model
|
18 |
|
19 |
model = load_graph_decoder()
|
@@ -24,6 +25,7 @@ def generate_polymer(CH4, CO2, H2, N2, O2, guidance_scale):
|
|
24 |
properties = [CH4, CO2, H2, N2, O2]
|
25 |
|
26 |
try:
|
|
|
27 |
model.to(device)
|
28 |
generated_molecule, _ = model.generate(properties, device=device, guide_scale=guidance_scale)
|
29 |
|
|
|
3 |
import torch
|
4 |
from rdkit import Chem
|
5 |
from rdkit.Chem import Draw
|
6 |
+
# from graph_decoder.diffusion_model import GraphDiT
|
7 |
|
8 |
# Load the model
|
9 |
def load_graph_decoder(path='model_labeled'):
|
10 |
+
# model = GraphDiT(
|
11 |
+
# model_config_path=f"{path}/config.yaml",
|
12 |
+
# data_info_path=f"{path}/data.meta.json",
|
13 |
+
# model_dtype=torch.float32,
|
14 |
+
# )
|
15 |
+
# model.init_model(path)
|
16 |
+
# model.disable_grads()
|
17 |
+
model = None
|
18 |
return model
|
19 |
|
20 |
model = load_graph_decoder()
|
|
|
25 |
properties = [CH4, CO2, H2, N2, O2]
|
26 |
|
27 |
try:
|
28 |
+
print('enter generate polymer')
|
29 |
model.to(device)
|
30 |
generated_molecule, _ = model.generate(properties, device=device, guide_scale=guidance_scale)
|
31 |
|