jfataphd commited on
Commit
6ea76b0
·
1 Parent(s): 1fef7d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -257,24 +257,18 @@ if query:
257
 
258
  # Add circles for the top 50 similar words
259
  fig.add_trace(go.Scatter(x=X_top[:, 0], y=X_top[:, 1], mode='markers',
260
- marker=dict(size=2, color=sims_query_top, colorscale='RdYlGn', symbol='circle'),
261
- text=words, customdata=sims, name=''))
262
-
263
-
264
-
265
-
266
 
267
  # Represent query as a large red diamond
268
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='markers',
269
  marker=dict(size=12, color='black', symbol='diamond'), name=query, hovertext=query,
270
- showlegend=False))
271
- # Set layer property of scatter trace with diamond to 'above'
272
- fig.update_traces(mode='markers', marker=dict(layer='above'), selector=dict(type='scatter', symbol='diamond'))
273
 
274
  # Add label for the query above the diamond
275
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='text', text=[query],
276
- textposition='top right', textfont=dict(color='blue', size=10), hoverinfo='none',
277
- showlegend=False))
278
 
279
  fig.update(layout_coloraxis_showscale=True)
280
  fig.update_layout(autosize=True, paper_bgcolor="#CCFFFF", margin=dict(t=0, b=0, l=0, r=0))
@@ -282,6 +276,7 @@ if query:
282
 
283
  st.plotly_chart(fig, use_container_width=True)
284
 
 
285
  st.markdown(
286
  f"<b><p style='font-family: Arial; font-size: 20px; font-style: Bold;'>Top <span style='color:red; font-style: italic;'>{value_word} "
287
  f"</span>words contextually and semantically similar to "
 
257
 
258
  # Add circles for the top 50 similar words
259
  fig.add_trace(go.Scatter(x=X_top[:, 0], y=X_top[:, 1], mode='markers',
260
+ marker=dict(size=2, color=sims_query_top, colorscale='RdYlGn', symbol='circle'),
261
+ text=words, customdata=sims, name='', layer='below'))
 
 
 
 
262
 
263
  # Represent query as a large red diamond
264
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='markers',
265
  marker=dict(size=12, color='black', symbol='diamond'), name=query, hovertext=query,
266
+ showlegend=False, layer='above'))
 
 
267
 
268
  # Add label for the query above the diamond
269
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='text', text=[query],
270
+ textposition='top right', textfont=dict(color='blue', size=10), hoverinfo='none',
271
+ showlegend=False))
272
 
273
  fig.update(layout_coloraxis_showscale=True)
274
  fig.update_layout(autosize=True, paper_bgcolor="#CCFFFF", margin=dict(t=0, b=0, l=0, r=0))
 
276
 
277
  st.plotly_chart(fig, use_container_width=True)
278
 
279
+
280
  st.markdown(
281
  f"<b><p style='font-family: Arial; font-size: 20px; font-style: Bold;'>Top <span style='color:red; font-style: italic;'>{value_word} "
282
  f"</span>words contextually and semantically similar to "