Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -189,6 +189,13 @@ if 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,11 +205,8 @@ if query:
|
|
198 |
pd.set_option('display.max_rows', None)
|
199 |
table2 = table.copy()
|
200 |
|
201 |
-
|
202 |
-
|
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 +236,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 |
-
|
237 |
-
|
238 |
-
|
239 |
fig.update_coloraxes(colorbar_title="Similarity with query")
|
240 |
|
241 |
# Represent query as a large red diamond
|
@@ -465,6 +469,9 @@ 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,8 +506,8 @@ 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.8,
|
503 |
-
|
504 |
scene=dict(xaxis_title="Dimension 1", yaxis_title="Dimension 2", zaxis_title="Dimension 3"))
|
505 |
fig2.update_coloraxes(colorbar_title="Similarity with query")
|
506 |
|
|
|
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 |
pd.set_option('display.max_rows', None)
|
206 |
table2 = table.copy()
|
207 |
|
208 |
+
st.markdown(f"Top 10000 words in an interactive embedding map for {query} in {database_name} PubMed corpus",
|
209 |
+
unsafe_allow_html=True)
|
|
|
|
|
|
|
210 |
|
211 |
# Set the max number of words to display
|
212 |
value_word = min(100, len(table2))
|
|
|
236 |
yaxis=dict(gridcolor='#CCFFFF', color='blue'))
|
237 |
|
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=.8, xanchor='center', yanchor='top',
|
242 |
+
# font=dict(color='black')))
|
243 |
fig.update_coloraxes(colorbar_title="Similarity with query")
|
244 |
|
245 |
# Represent query as a large red diamond
|
|
|
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 |
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.8,
|
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")
|
513 |
|