jfataphd commited on
Commit
029e89d
1 Parent(s): ca5383a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -198,11 +198,11 @@ if query:
198
  pd.set_option('display.max_rows', None)
199
  table2 = table.copy()
200
 
201
- # st.markdown(f"<b><p style='font-family: Arial; font-size: 20px;'>Populate a treemap to visualize "
202
- # f"<span style='color:red; font-style: italic;'>words</span> contextually "
203
- # f"and semantically similar to <span style='color:red; font-style: italic;'>{query}</span> "
204
- # f"within the <span style='color:red; font-style: italic;'>{database_name}</span> corpus.</p></b>",
205
- # unsafe_allow_html=True)
206
 
207
  # Set the max number of words to display
208
  value_word = min(100, len(table2))
@@ -232,10 +232,10 @@ if query:
232
  yaxis=dict(gridcolor='#CCFFFF', color='blue'))
233
 
234
  # fig.update_traces(hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
235
- fig.update_layout(title=dict(
236
- text=f"Top 10000 words in an interactive embedding map for {query} in {database_name} PubMed corpus"
237
- f": Zoom in to the black diamond to find {query}", x=0.5, y=1, xanchor='center', yanchor='top',
238
- font=dict(color='black')))
239
  fig.update_coloraxes(colorbar_title="Similarity with query")
240
 
241
  # Represent query as a large red diamond
@@ -465,6 +465,12 @@ if query:
465
  st.warning(
466
  f"This selection exceeds the number of similar proteins related to {query} within the {database_name} corpus, please choose a lower number")
467
 
 
 
 
 
 
 
468
  try:
469
  # Get the top 50 similar genes to the query
470
  value_gene = min(df_len, 50)
@@ -499,7 +505,7 @@ if query:
499
  fig2.update_traces(
500
  hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
501
  fig2.update_layout(
502
- title=dict(text=f"Word embedding map for {query} in {database_name} PubMed corpus", x=0.5, y=0.95,
503
  xanchor='center', yanchor='top', font=dict(color='black')),
504
  scene=dict(xaxis_title="Dimension 1", yaxis_title="Dimension 2", zaxis_title="Dimension 3"))
505
  fig2.update_coloraxes(colorbar_title="Similarity with query")
 
198
  pd.set_option('display.max_rows', None)
199
  table2 = table.copy()
200
 
201
+ st.markdown(
202
+ f"<h2 style='text-align: center; font-family: Arial; font-size: 20px; font-weight: bold;'>"
203
+ f"Top <span style='color:red; font-style: italic;'>10000</span> words in an interactive embedding map most similar to <span style='color:red; font-style: italic;'>{query}</span> in <span style='color:red; font-style: italic;'>{database_name}</span> "
204
+ f"PubMed corpus: Zoom in to the black diamond to find <span style='color:red; font-style: italic;'>{query}</span></h2>",
205
+ unsafe_allow_html=True)
206
 
207
  # Set the max number of words to display
208
  value_word = min(100, len(table2))
 
232
  yaxis=dict(gridcolor='#CCFFFF', color='blue'))
233
 
234
  # fig.update_traces(hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
235
+ # fig.update_layout(title=dict(
236
+ # text=f"Top 10000 words in an interactive embedding map for {query} in {database_name} PubMed corpus"
237
+ # f": Zoom in to the black diamond to find {query}", x=0.5, y=1, xanchor='center', yanchor='top',
238
+ # font=dict(color='black')))
239
  fig.update_coloraxes(colorbar_title="Similarity with query")
240
 
241
  # Represent query as a large red diamond
 
465
  st.warning(
466
  f"This selection exceeds the number of similar proteins related to {query} within the {database_name} corpus, please choose a lower number")
467
 
468
+ st.markdown(
469
+ f"<h2 style='text-align: center; font-family: Arial; font-size: 20px; font-weight: bold;'>3D interactive "
470
+ f"gene embedding map for <span style='color:red; font-style: italic;'>{value_gene}</span> genes most similar "
471
+ f"with <span style='color:red; font-style: italic;'>{query}</span> in <span style='color:red; font-style: italic;'>{database_name}</span> PubMed corpus</h2>",
472
+ unsafe_allow_html=True)
473
+
474
  try:
475
  # Get the top 50 similar genes to the query
476
  value_gene = min(df_len, 50)
 
505
  fig2.update_traces(
506
  hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
507
  fig2.update_layout(
508
+ title=dict(text=f"", x=0.5, y=0.95,
509
  xanchor='center', yanchor='top', font=dict(color='black')),
510
  scene=dict(xaxis_title="Dimension 1", yaxis_title="Dimension 2", zaxis_title="Dimension 3"))
511
  fig2.update_coloraxes(colorbar_title="Similarity with query")