Yin Fang
commited on
Commit
Β·
8d62ec9
1
Parent(s):
1def893
Update app.py
Browse files
app.py
CHANGED
@@ -139,7 +139,10 @@ def opt_process(opt_input):
|
|
139 |
results = data[(data['improvement']> 0) & (data['sim']>0.4)]
|
140 |
opt_output = results["candidates"].tolist()
|
141 |
opt_output_imp = results["improvement"].tolist()
|
|
|
142 |
opt_output_sim = results["sim"].tolist()
|
|
|
|
|
143 |
|
144 |
smis = [sf.decoder(i) for i in opt_output]
|
145 |
mols = []
|
@@ -153,18 +156,7 @@ def opt_process(opt_input):
|
|
153 |
subImgSize=(200,200),
|
154 |
legends=['' for x in mols]
|
155 |
)
|
156 |
-
|
157 |
-
return opt_input_img, "\n".join(opt_output), opt_output_imp, opt_output_sim, opt_output_img
|
158 |
-
# examples = [
|
159 |
-
|
160 |
-
# ['[C][C][=Branch1][C][=O][N][C][C][O][C][C][O][C][C][O][C][C][Ring1][N]'],['[C][C][S][C][C][S][C][C][C][S][C][C][S][C][Ring1][=C]']
|
161 |
-
|
162 |
-
# ]
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
# iface = gr.Interface(fn=greet, inputs="text", outputs="numpy", title="Molecular Language Model as Multi-task Generator",examples=examples)
|
167 |
-
# iface.launch()
|
168 |
|
169 |
with gr.Blocks() as demo:
|
170 |
gr.Markdown("# MolGen: Molecular Language Model as Multi-task Generator")
|
@@ -178,7 +170,7 @@ with gr.Blocks() as demo:
|
|
178 |
|
179 |
with gr.Column():
|
180 |
gen_output = gr.Textbox(label="Generation Results", lines=5, placeholder="")
|
181 |
-
gen_output_image = gr.Image(
|
182 |
|
183 |
gr.Examples(
|
184 |
examples=[["[C][=C][C][=C][C][=C][Ring1][=Branch1]"],
|
@@ -202,7 +194,7 @@ with gr.Blocks() as demo:
|
|
202 |
opt_output_imp = gr.Textbox(label="Optimization Property Improvements", lines=3, placeholder="")
|
203 |
opt_output_sim = gr.Textbox(label="Similarity", lines=3, placeholder="")
|
204 |
opt_output_img = gr.Textbox(label="Output Visualization", lines=3, placeholder="")
|
205 |
-
opt_output_img = gr.Image(
|
206 |
|
207 |
gr.Examples(
|
208 |
examples=[
|
|
|
139 |
results = data[(data['improvement']> 0) & (data['sim']>0.4)]
|
140 |
opt_output = results["candidates"].tolist()
|
141 |
opt_output_imp = results["improvement"].tolist()
|
142 |
+
opt_output_imp = [str(i) for i in opt_output_imp]
|
143 |
opt_output_sim = results["sim"].tolist()
|
144 |
+
opt_output_sim = [str(i) for i in opt_output_sim]
|
145 |
+
|
146 |
|
147 |
smis = [sf.decoder(i) for i in opt_output]
|
148 |
mols = []
|
|
|
156 |
subImgSize=(200,200),
|
157 |
legends=['' for x in mols]
|
158 |
)
|
159 |
+
return opt_input_img, "\n".join(opt_output), "\n".join(opt_output_imp), "\n".join(opt_output_sim), opt_output_img
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
with gr.Blocks() as demo:
|
162 |
gr.Markdown("# MolGen: Molecular Language Model as Multi-task Generator")
|
|
|
170 |
|
171 |
with gr.Column():
|
172 |
gen_output = gr.Textbox(label="Generation Results", lines=5, placeholder="")
|
173 |
+
gen_output_image = gr.Image(label="Visualization")
|
174 |
|
175 |
gr.Examples(
|
176 |
examples=[["[C][=C][C][=C][C][=C][Ring1][=Branch1]"],
|
|
|
194 |
opt_output_imp = gr.Textbox(label="Optimization Property Improvements", lines=3, placeholder="")
|
195 |
opt_output_sim = gr.Textbox(label="Similarity", lines=3, placeholder="")
|
196 |
opt_output_img = gr.Textbox(label="Output Visualization", lines=3, placeholder="")
|
197 |
+
opt_output_img = gr.Image(label="Output Visualization")
|
198 |
|
199 |
gr.Examples(
|
200 |
examples=[
|