sadgaj commited on
Commit
3cfc3d1
·
1 Parent(s): b8588c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -79,8 +79,22 @@ def greet(name):
79
  )
80
  sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
81
  sf_output = list(set(sf_output))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- return sf_output
84
 
85
 
86
 
@@ -94,5 +108,5 @@ examples = [
94
 
95
 
96
 
97
- iface = gr.Interface(fn=greet, inputs="text", outputs="text", title="Molecular Language Model as Multi-task Generator",examples=examples)
98
  iface.launch()
 
79
  )
80
  sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
81
  sf_output = list(set(sf_output))
82
+ input_sm = sf_decode(input)
83
+ sm_output = [sf_decode(sf) for sf in sf_output]
84
+
85
+
86
+
87
+ input_plogp = plogp(input_sm)
88
+ plogp_improve = [plogp(i)-input_plogp for i in sm_output]
89
+
90
+
91
+ sim = [sim(i,input_sm) for i in sm_output]
92
+
93
+ candidate_selfies = {"candidates": sf_output, "improvement": plogp_improve, "sim": sim}
94
+ data = pd.DataFrame(candidate_selfies)
95
+
96
+ return data[(data['improvement']> 0) & (data['sim']>0.4)]
97
 
 
98
 
99
 
100
 
 
108
 
109
 
110
 
111
+ iface = gr.Interface(fn=greet, inputs="text", outputs="dataframe", title="Molecular Language Model as Multi-task Generator",examples=examples)
112
  iface.launch()