Trương Gia Bảo commited on
Commit
30872a6
·
1 Parent(s): 4bc10ce
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. about.png +0 -0
  3. app.py +50 -12
  4. img/about1.png +3 -0
  5. img/about2.png +3 -0
  6. img/about3.png +3 -0
  7. img/model_fig.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
  model.iter-685000 filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
  model.iter-685000 filter=lfs diff=lfs merge=lfs -text
36
+ *.png filter=lfs diff=lfs merge=lfs -text
about.png CHANGED

Git LFS Details

  • SHA256: 68e444d4db2b327e71ac05f2a5d2d1f12e009d279d66ecbe0caad66b0d175eb4
  • Pointer size: 131 Bytes
  • Size of remote file: 430 kB
app.py CHANGED
@@ -56,9 +56,9 @@ def img_to_bytes(img_path):
56
  img_bytes = Path(img_path).read_bytes()
57
  encoded = base64.b64encode(img_bytes).decode()
58
  return encoded
59
- def img_to_html(img_path):
60
- img_html = "<img src='data:image/png;base64,{}' class='img-fluid' style='max-width: 500px;'>".format(
61
- img_to_bytes(img_path)
62
  )
63
  return img_html
64
 
@@ -276,8 +276,11 @@ def colorize_step(n_step,cur_step):
276
  return color_list
277
 
278
  def form_header():
279
- st.markdown("<h1 style='text-align: center;'>Junction Tree Variational Autoencoder for Molecular Graph Generation (JTVAE)</h1>",unsafe_allow_html=True)
280
- st.markdown("<h3 style='text-align: center;'>Wengong Jin, Regina Barzilay, Tommi Jaakkola</h3>",unsafe_allow_html=True)
 
 
 
281
 
282
  # determines button color which should be red when user is on that given step
283
  oam_type = 'primary' if st.session_state['current_view'] == 0 else 'secondary'
@@ -309,14 +312,49 @@ def form_body():
309
  About()
310
 
311
  def About():
312
- descrip = '''
313
  We seek to automate the design of molecules based on specific chemical properties. In computational terms, this task involves continuous embedding and generation of molecular graphs. Our primary contribution is the direct realization of molecular graphs, a task previously approached by generating linear SMILES strings instead of graphs. Our junction tree variational autoencoder generates molecular graphs in two phases, by first generating a tree-structured scaffold over chemical substructures, and then combining them into a molecule with a graph message passing network. This approach allows us to incrementally expand molecules while maintaining chemical validity at every step. We evaluate our model on multiple tasks ranging from molecular generation to optimization. Across these tasks, our model outperforms previous state-of-the-art baselines by a significant margin.
314
-
315
- [https://arxiv.org/abs/1802.04364](https://arxiv.org/abs/1802.04364)'''
316
- st.markdown(descrip)
317
- st.markdown("<p style='text-align: center;'>"+
318
- img_to_html('about.png')+
319
- "</p>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
 
321
  def Optimize_a_molecule():
322
  st.markdown("<h2 style='text-align: center;'>Optimize a molecule</h2>",unsafe_allow_html=True)
 
56
  img_bytes = Path(img_path).read_bytes()
57
  encoded = base64.b64encode(img_bytes).decode()
58
  return encoded
59
+ def img_to_html(img_path,max_width=500):
60
+ img_html = "<img src='data:image/png;base64,{}' class='img-fluid' style='max-width: {}px;'>".format(
61
+ img_to_bytes(img_path), max_width
62
  )
63
  return img_html
64
 
 
276
  return color_list
277
 
278
  def form_header():
279
+ st.markdown("<h1 style='padding: 25px;text-align: center;color: white;background-color: tomato;'>Molecular Optimization using Junction Tree Variational Autoencoder</h1>",unsafe_allow_html=True)
280
+ st.markdown("<h4 style='padding: 10px;text-align: center;color: white;background-color: mediumseagreen;'>Gia-Bao Truong</h4>",unsafe_allow_html=True)
281
+ with st.expander(':star2: About the model'):
282
+ st.markdown("<p style='text-align: center;'>Based on Junction Tree Variational Autoencoder for Molecular Graph Generation (JTVAE)</p>",unsafe_allow_html=True)
283
+ st.markdown("<p style='text-align: center;'>Wengong Jin, Regina Barzilay, Tommi Jaakkola</p>",unsafe_allow_html=True)
284
 
285
  # determines button color which should be red when user is on that given step
286
  oam_type = 'primary' if st.session_state['current_view'] == 0 else 'secondary'
 
312
  About()
313
 
314
  def About():
315
+ descrip_model = '''
316
  We seek to automate the design of molecules based on specific chemical properties. In computational terms, this task involves continuous embedding and generation of molecular graphs. Our primary contribution is the direct realization of molecular graphs, a task previously approached by generating linear SMILES strings instead of graphs. Our junction tree variational autoencoder generates molecular graphs in two phases, by first generating a tree-structured scaffold over chemical substructures, and then combining them into a molecule with a graph message passing network. This approach allows us to incrementally expand molecules while maintaining chemical validity at every step. We evaluate our model on multiple tasks ranging from molecular generation to optimization. Across these tasks, our model outperforms previous state-of-the-art baselines by a significant margin.
317
+ '''
318
+ img_caption = '''
319
+ Figure 3. Overview of our method: A molecular graph G is first decomposed into its junction tree TG, where each colored node in the tree represents a substructure in the molecule. We then encode both the tree and graph into their latent embeddings zT and zG. To decode the molecule, we first reconstruct junction tree from zT , and then assemble nodes in the tree back to the original molecule.'''
320
+
321
+ with st.expander(':four_leaf_clover: About the author',expanded=True):
322
+ st.markdown("<h4 style='text-align:center;'>Gia-Bao Truong</h4>",unsafe_allow_html=True)
323
+ st.markdown("<h4 style='color:tomato; text-align:center;'>Student at</h4>",unsafe_allow_html=True)
324
+ st.markdown("<p style='text-align:center;'>"+
325
+ img_to_html('img/about1.png',64)+' '+img_to_html('img/about2.png',64)+
326
+ "</p>", unsafe_allow_html=True)
327
+ st.markdown("<h5 style='text-align:center;'>Faculty of Pharmacy, University of Medicine and Pharmacy at Ho Chi Minh City</h5>",unsafe_allow_html=True)
328
+ st.markdown("<h4 style='color:tomato; text-align:center;'>Team</h4>",unsafe_allow_html=True)
329
+ st.markdown("<p style='text-align:center;'>"+
330
+ img_to_html('img/about3.png',64)+
331
+ "</p>", unsafe_allow_html=True)
332
+ st.markdown("<h5 style='text-align:center;'>MedAI</h5>",unsafe_allow_html=True)
333
+
334
+
335
+ with st.expander(':star2: About the model',expanded=True):
336
+ st.markdown("Based on Junction Tree Variational Autoencoder for Molecular Graph Generation (JTVAE)",unsafe_allow_html=True)
337
+ st.markdown("<h4 style='color:tomato;'>Citing</h4>",unsafe_allow_html=True)
338
+ st.markdown("Paper: [https://arxiv.org/abs/1802.04364](https://arxiv.org/abs/1802.04364)")
339
+ st.code('''@misc{jin2019junction,
340
+ title={Junction Tree Variational Autoencoder for Molecular Graph Generation},
341
+ author={Wengong Jin and Regina Barzilay and Tommi Jaakkola},
342
+ year={2019},
343
+ eprint={1802.04364},
344
+ archivePrefix={arXiv},
345
+ primaryClass={cs.LG}
346
+ }''')
347
+ st.markdown("<h4 style='color:tomato;'>Author</h4>",unsafe_allow_html=True)
348
+ st.markdown("Wengong Jin, Regina Barzilay, Tommi Jaakkola",unsafe_allow_html=True)
349
+ st.markdown("<h4 style='color:tomato;'>Abstract</h4>",unsafe_allow_html=True)
350
+ st.markdown(descrip_model)
351
+ ab = st.columns([1,10,1])
352
+ ab[1].markdown("<p style='text-align: center;'>"+
353
+ img_to_html('img/model_fig.png')+
354
+ "</p>", unsafe_allow_html=True)
355
+ ab[1].markdown("<p style='text-align: center;'>"+
356
+ img_caption+
357
+ "</p>",unsafe_allow_html=True)
358
 
359
  def Optimize_a_molecule():
360
  st.markdown("<h2 style='text-align: center;'>Optimize a molecule</h2>",unsafe_allow_html=True)
img/about1.png ADDED

Git LFS Details

  • SHA256: 7dba83f1894abad4ab927773fa957c2ab137fbbf7f58e52a5d8e82d74d9572fe
  • Pointer size: 130 Bytes
  • Size of remote file: 20.2 kB
img/about2.png ADDED

Git LFS Details

  • SHA256: 00a5a559df78f9ba56a0db24fcaf7920a1092379ad0ae6f3ec8a6b57026ca53c
  • Pointer size: 131 Bytes
  • Size of remote file: 337 kB
img/about3.png ADDED

Git LFS Details

  • SHA256: 3898c2a7f197651b156830f6362aac296502ee186db6737609e22ec7560c5534
  • Pointer size: 132 Bytes
  • Size of remote file: 1.01 MB
img/model_fig.png ADDED

Git LFS Details

  • SHA256: 68e444d4db2b327e71ac05f2a5d2d1f12e009d279d66ecbe0caad66b0d175eb4
  • Pointer size: 131 Bytes
  • Size of remote file: 430 kB