jfataphd commited on
Commit
4c7c051
·
1 Parent(s): 141a2d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -253,6 +253,13 @@ if query:
253
  # font=dict(color='black')))
254
  fig.update_coloraxes(colorbar_title=f"Similarity with {query}")
255
 
 
 
 
 
 
 
 
256
  # Represent query as a large red diamond
257
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='markers',
258
  marker=dict(size=12, color='black', symbol='diamond'), name=query, hovertext=query,
@@ -261,12 +268,7 @@ if query:
261
  # Add label for the query above the diamond
262
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='text', text=[query],
263
  textposition='top right', textfont=dict(color='blue', size=10), hoverinfo='none',
264
- showlegend=False))
265
-
266
- # Add circles for the top 50 similar words
267
- fig.add_trace(go.Scatter(x=X_top[:, 0], y=X_top[:, 1], mode='markers',
268
- marker=dict(size=2, color=sims_query_top, colorscale='RdYlGn', symbol='circle'),
269
- text=words, customdata=sims, name=''))
270
 
271
  fig.update(layout_coloraxis_showscale=True)
272
  fig.update_layout(autosize=True, paper_bgcolor="#CCFFFF", margin=dict(t=0, b=0, l=0, r=0))
 
253
  # font=dict(color='black')))
254
  fig.update_coloraxes(colorbar_title=f"Similarity with {query}")
255
 
256
+
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
  # 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,
 
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, layer='above traces'))
 
 
 
 
 
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))