jfataphd commited on
Commit
78a2dc3
·
1 Parent(s): ae14842

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -253,25 +253,20 @@ if query:
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='', z=1))
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, z=2))
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, z=3))
272
 
273
- # Set the order of the traces
274
- fig.update_layout(legend=dict(traceorder='reversed'), showlegend=True)
 
 
275
 
276
  fig.update(layout_coloraxis_showscale=True)
277
  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
  # 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,
259
+ showlegend=False))
260
 
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))