wilmerags commited on
Commit
2f7dfa0
β€’
1 Parent(s): 61ce655

feat: Add caption for '-1' labelled tweets

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -6,7 +6,7 @@ import streamlit as st
6
  import tweepy
7
  import hdbscan
8
 
9
- from bokeh.models import ColumnDataSource, HoverTool
10
  from bokeh.palettes import Cividis256 as Pallete
11
  from bokeh.plotting import Figure, figure
12
  from bokeh.transform import factor_cmap
@@ -62,6 +62,11 @@ def draw_interactive_scatter_plot(
62
  # p.xgrid.grid_line_color = None
63
  # p.ygrid.grid_line_color = None
64
  p.toolbar.logo = None
 
 
 
 
 
65
  return p
66
 
67
  # Up to here
@@ -82,7 +87,7 @@ def generate_plot(
82
  with st.spinner("Now trying to express them with my own words... πŸ’¬"):
83
  embeddings_2d = get_tsne_embeddings(embeddings)
84
  plot = draw_interactive_scatter_plot(
85
- tws, embeddings_2d[:, 0], embeddings_2d[:, 1], encoded_labels, encoded_labels, 'Tweet', 'Topic (-1 = None)'
86
  )
87
  return plot
88
 
 
6
  import tweepy
7
  import hdbscan
8
 
9
+ from bokeh.models import ColumnDataSource, HoverTool, Label
10
  from bokeh.palettes import Cividis256 as Pallete
11
  from bokeh.plotting import Figure, figure
12
  from bokeh.transform import factor_cmap
 
62
  # p.xgrid.grid_line_color = None
63
  # p.ygrid.grid_line_color = None
64
  p.toolbar.logo = None
65
+
66
+ disclaimer = Label(x=xs.min(), y=ys.min(), x_units="screen", y_units="screen",
67
+ text_font_size="11px", text_color="silver",
68
+ text="Topic equals -1 means no topic was detected for such tweet")
69
+ p.add_layout(disclaimer, "below")
70
  return p
71
 
72
  # Up to here
 
87
  with st.spinner("Now trying to express them with my own words... πŸ’¬"):
88
  embeddings_2d = get_tsne_embeddings(embeddings)
89
  plot = draw_interactive_scatter_plot(
90
+ tws, embeddings_2d[:, 0], embeddings_2d[:, 1], encoded_labels, encoded_labels, 'Tweet', 'Topic'
91
  )
92
  return plot
93