Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -189,13 +189,6 @@ if query:
|
|
189 |
# st.stop()
|
190 |
st.markdown("---")
|
191 |
|
192 |
-
st.markdown(
|
193 |
-
f"<b><p style='font-family: Arial; font-size: 20px; font-style: Bold;'>Top <span style='color:red; font-style: italic;'>{value_word} "
|
194 |
-
f"</span>words contextually and semantically similar to "
|
195 |
-
f"<span style='color:red; font-style: italic;'>{query} </span>within the <span style='color:red; font-style: italic;'>{database_name}</span> corpus. "
|
196 |
-
f"Click on the squares to expand and also the PubMed and Wikipedia links for more word information</span></p></b>",
|
197 |
-
unsafe_allow_html=True)
|
198 |
-
|
199 |
try:
|
200 |
table = model.wv.most_similar_cosmul(query, topn=10000)
|
201 |
table = (pd.DataFrame(table))
|
@@ -205,8 +198,11 @@ if query:
|
|
205 |
pd.set_option('display.max_rows', None)
|
206 |
table2 = table.copy()
|
207 |
|
208 |
-
st.markdown(f"
|
209 |
-
|
|
|
|
|
|
|
210 |
|
211 |
# Set the max number of words to display
|
212 |
value_word = min(100, len(table2))
|
@@ -238,7 +234,7 @@ if query:
|
|
238 |
# fig.update_traces(hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
|
239 |
fig.update_layout(title=dict(
|
240 |
text=f"Top 10000 words in an interactive embedding map for {query} in {database_name} PubMed corpus"
|
241 |
-
f": Zoom in to the black diamond to find {query}", x=0.5, y
|
242 |
font=dict(color='black')))
|
243 |
fig.update_coloraxes(colorbar_title="Similarity with query")
|
244 |
|
@@ -469,9 +465,6 @@ if query:
|
|
469 |
st.warning(
|
470 |
f"This selection exceeds the number of similar proteins related to {query} within the {database_name} corpus, please choose a lower number")
|
471 |
|
472 |
-
st.markdown(f"3D interacive gene embedding map for {query} in {database_name} PubMed corpus",
|
473 |
-
unsafe_allow_html=True)
|
474 |
-
|
475 |
try:
|
476 |
# Get the top 50 similar genes to the query
|
477 |
value_gene = min(df_len, 50)
|
@@ -506,7 +499,7 @@ if query:
|
|
506 |
fig2.update_traces(
|
507 |
hovertemplate='<b>%{hovertext}</b><br>Similarity score: %{customdata[0]:.2f}<extra></extra>')
|
508 |
fig2.update_layout(
|
509 |
-
title=dict(text=f"Word embedding map for {query} in {database_name} PubMed corpus", x=0.5, y=0.
|
510 |
xanchor='center', yanchor='top', font=dict(color='black')),
|
511 |
scene=dict(xaxis_title="Dimension 1", yaxis_title="Dimension 2", zaxis_title="Dimension 3"))
|
512 |
fig2.update_coloraxes(colorbar_title="Similarity with query")
|
|
|
189 |
# st.stop()
|
190 |
st.markdown("---")
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
try:
|
193 |
table = model.wv.most_similar_cosmul(query, topn=10000)
|
194 |
table = (pd.DataFrame(table))
|
|
|
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))
|
|
|
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 |
|
|
|
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 |
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")
|