Spaces:
Running
Running
thomas0809
commited on
Commit
•
f07373b
1
Parent(s):
bec3c91
update checkpoint
Browse files
app.py
CHANGED
@@ -12,13 +12,13 @@ from indigo.renderer import IndigoRenderer
|
|
12 |
from huggingface_hub import hf_hub_download
|
13 |
|
14 |
REPO_ID = "yujieq/MolScribe"
|
15 |
-
FILENAME = "
|
16 |
ckpt_path = hf_hub_download(REPO_ID, FILENAME)
|
17 |
|
18 |
device = torch.device('cpu')
|
19 |
model = MolScribe(ckpt_path, device)
|
20 |
|
21 |
-
def
|
22 |
indigo = Indigo()
|
23 |
render = IndigoRenderer(indigo)
|
24 |
indigo.setOption('render-output-format', 'png')
|
@@ -32,7 +32,7 @@ def generate_image(molblock):
|
|
32 |
|
33 |
def predict(image):
|
34 |
smiles, molblock = model.predict_image(image)
|
35 |
-
image =
|
36 |
return image, smiles, molblock
|
37 |
|
38 |
iface = gr.Interface(
|
|
|
12 |
from huggingface_hub import hf_hub_download
|
13 |
|
14 |
REPO_ID = "yujieq/MolScribe"
|
15 |
+
FILENAME = "swin_base_char_aux_1m.pth"
|
16 |
ckpt_path = hf_hub_download(REPO_ID, FILENAME)
|
17 |
|
18 |
device = torch.device('cpu')
|
19 |
model = MolScribe(ckpt_path, device)
|
20 |
|
21 |
+
def generate_mol_image(molblock):
|
22 |
indigo = Indigo()
|
23 |
render = IndigoRenderer(indigo)
|
24 |
indigo.setOption('render-output-format', 'png')
|
|
|
32 |
|
33 |
def predict(image):
|
34 |
smiles, molblock = model.predict_image(image)
|
35 |
+
image = generate_mol_image(molblock)
|
36 |
return image, smiles, molblock
|
37 |
|
38 |
iface = gr.Interface(
|