AIEcosystem commited on
Commit
334f787
·
verified ·
1 Parent(s): d91c31a

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +6 -3
src/streamlit_app.py CHANGED
@@ -79,7 +79,9 @@ def highlight_entities(text, df_entities):
79
  color = entity_color_map.get(label, '#000000')
80
  # Create a span with background color and tooltip
81
  # Change the foreground text color to BLACK, and use a white shadow for readability
82
- highlight_html = f'<span style="background-color: {color}; color: #000000; padding: 2px 4px; border-radius: 3px; cursor: help; text-shadow: 0.5px 0.5px 0px #FFFFFF;" title="{label}">{entity_text}</span>'
 
 
83
 
84
  # Replace the original text segment with the highlighted HTML
85
  highlighted_text = highlighted_text[:start] + highlight_html + highlighted_text[end:]
@@ -148,12 +150,13 @@ def create_topic_word_bubbles(df_topic_data):
148
  fig.update_layout(
149
  xaxis_title="Entity/Word (Bubble size = Word Weight)",
150
  yaxis_title="Word Weight",
151
- xaxis={'tickangle': -45, 'showgrid': False, 'showticklabels': False},
152
  yaxis={'showgrid': True},
153
  showlegend=True,
154
  plot_bgcolor='#f9f9f9', # Changed from pink
155
  paper_bgcolor='#f9f9f9', # Changed from pink
156
- height=800,
 
157
  margin=dict(t=50, b=100, l=50, r=10),
158
  )
159
  fig.update_traces(hovertemplate='<b>%{customdata[0]}</b><br>Weight: %{customdata[1]:.3f}<extra></extra>', marker=dict(line=dict(width=1, color='DarkSlateGrey')))
 
79
  color = entity_color_map.get(label, '#000000')
80
  # Create a span with background color and tooltip
81
  # Change the foreground text color to BLACK, and use a white shadow for readability
82
+ # Force text color to BLACK and add a clear, contrasting border
83
+ # In the 'highlight_entities' function:
84
+ highlight_html = f'<span style="background-color: {color}; color: #000000; padding: 2px 4px; border-radius: 3px; cursor: help; border: 1px solid #FFFFFF;" title="{label}">{entity_text}</span>'
85
 
86
  # Replace the original text segment with the highlighted HTML
87
  highlighted_text = highlighted_text[:start] + highlight_html + highlighted_text[end:]
 
150
  fig.update_layout(
151
  xaxis_title="Entity/Word (Bubble size = Word Weight)",
152
  yaxis_title="Word Weight",
153
+ xaxis={'tickangle': -45, 'showgrid': False, 'showticklabels': False, 'range': [0, 10]},
154
  yaxis={'showgrid': True},
155
  showlegend=True,
156
  plot_bgcolor='#f9f9f9', # Changed from pink
157
  paper_bgcolor='#f9f9f9', # Changed from pink
158
+ height=1000,
159
+ autosize=False,
160
  margin=dict(t=50, b=100, l=50, r=10),
161
  )
162
  fig.update_traces(hovertemplate='<b>%{customdata[0]}</b><br>Weight: %{customdata[1]:.3f}<extra></extra>', marker=dict(line=dict(width=1, color='DarkSlateGrey')))