jfataphd commited on
Commit
ae14842
·
1 Parent(s): 2da59f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -258,16 +258,17 @@ if query:
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 and label
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))
267
 
 
268
  fig.add_trace(go.Scatter(x=[model.wv[query][0]], y=[model.wv[query][1]], mode='text', text=[query],
269
  textposition='top right', textfont=dict(color='blue', size=10), hoverinfo='none',
270
- showlegend=False))
271
 
272
  # Set the order of the traces
273
  fig.update_layout(legend=dict(traceorder='reversed'), showlegend=True)
@@ -279,6 +280,7 @@ if query:
279
  st.plotly_chart(fig, use_container_width=True)
280
 
281
 
 
282
  st.markdown(
283
  f"<b><p style='font-family: Arial; font-size: 20px; font-style: Bold;'>Top <span style='color:red; font-style: italic;'>{value_word} "
284
  f"</span>words contextually and semantically similar to "
 
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)
 
280
  st.plotly_chart(fig, use_container_width=True)
281
 
282
 
283
+
284
  st.markdown(
285
  f"<b><p style='font-family: Arial; font-size: 20px; font-style: Bold;'>Top <span style='color:red; font-style: italic;'>{value_word} "
286
  f"</span>words contextually and semantically similar to "