File size: 1,046 Bytes
9b06241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# import evaluate
# from evaluate.utils import launch_gradio_widget
# import gradio as gr

# module = evaluate.load("saicharan2804/molgenevalmetric")
# # launch_gradio_widget(module)

# iface = gr.Interface(
#     fn = module,
#     inputs=[
#         gr.File(label="Generated SMILES"), 
#         gr.File(label="Training Data", value=None),
#         ],
#     outputs="text"
# )

# iface.launch()

# import pandas as pd

# df = pd.read_csv('/home/saicharan/Downloads/chembl.csv')

# df = df.rename(columns={'canonical_smiles': 'SMILES'})

# df = df[0:10000]

# print(df[['SMILES']].to_csv('/home/saicharan/Downloads/chembl_10000.csv'))
from scscore.scscore.standalone_model_numpy import SCScorer

import pandas as pd

model = SCScorer()
model.restore()

pubchem = pd.read_csv('/home/saicharan/Downloads/chembl_10000.csv')
    
# smis = ['CCCOCCC', 'CCCNc1ccccc1']
smis = pubchem['SMILES'].tolist()
smis = smis[0:1000]
print('computing')
average_score = model.get_avg_score(smis)

# Print the average score
print('Average score:', average_score)