Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +4 -3
src/streamlit_app.py
CHANGED
|
@@ -78,7 +78,8 @@ def highlight_entities(text, df_entities):
|
|
| 78 |
entity_text = entity['text']
|
| 79 |
color = entity_color_map.get(label, '#000000')
|
| 80 |
# Create a span with background color and tooltip
|
| 81 |
-
highlight_html = f'<span style="background-color: {color}; color: white; padding: 2px 4px; border-radius: 3px; cursor: help;" title="{label}">{entity_text}</span>'
|
|
|
|
| 82 |
# Replace the original text segment with the highlighted HTML
|
| 83 |
highlighted_text = highlighted_text[:start] + highlight_html + highlighted_text[end:]
|
| 84 |
# Use a div to mimic the Streamlit input box style for the report
|
|
@@ -133,7 +134,7 @@ def create_topic_word_bubbles(df_topic_data):
|
|
| 133 |
size='weight',
|
| 134 |
color='topic',
|
| 135 |
hover_name='word',
|
| 136 |
-
size_max=
|
| 137 |
title='Topic Word Weights (Bubble Chart)',
|
| 138 |
color_discrete_sequence=px.colors.qualitative.Bold,
|
| 139 |
labels={
|
|
@@ -151,7 +152,7 @@ def create_topic_word_bubbles(df_topic_data):
|
|
| 151 |
showlegend=True,
|
| 152 |
plot_bgcolor='#f9f9f9', # Changed from pink
|
| 153 |
paper_bgcolor='#f9f9f9', # Changed from pink
|
| 154 |
-
height=
|
| 155 |
margin=dict(t=50, b=100, l=50, r=10),
|
| 156 |
)
|
| 157 |
fig.update_traces(hovertemplate='<b>%{customdata[0]}</b><br>Weight: %{customdata[1]:.3f}<extra></extra>', marker=dict(line=dict(width=1, color='DarkSlateGrey')))
|
|
|
|
| 78 |
entity_text = entity['text']
|
| 79 |
color = entity_color_map.get(label, '#000000')
|
| 80 |
# Create a span with background color and tooltip
|
| 81 |
+
highlight_html = f'<span style="background-color: {color}; color: white; padding: 2px 4px; border-radius: 3px; cursor: help; text-shadow: 1px 1px 1px #000000;" title="{label}">{entity_text}</span>'
|
| 82 |
+
|
| 83 |
# Replace the original text segment with the highlighted HTML
|
| 84 |
highlighted_text = highlighted_text[:start] + highlight_html + highlighted_text[end:]
|
| 85 |
# Use a div to mimic the Streamlit input box style for the report
|
|
|
|
| 134 |
size='weight',
|
| 135 |
color='topic',
|
| 136 |
hover_name='word',
|
| 137 |
+
size_max=45,
|
| 138 |
title='Topic Word Weights (Bubble Chart)',
|
| 139 |
color_discrete_sequence=px.colors.qualitative.Bold,
|
| 140 |
labels={
|
|
|
|
| 152 |
showlegend=True,
|
| 153 |
plot_bgcolor='#f9f9f9', # Changed from pink
|
| 154 |
paper_bgcolor='#f9f9f9', # Changed from pink
|
| 155 |
+
height=750,
|
| 156 |
margin=dict(t=50, b=100, l=50, r=10),
|
| 157 |
)
|
| 158 |
fig.update_traces(hovertemplate='<b>%{customdata[0]}</b><br>Weight: %{customdata[1]:.3f}<extra></extra>', marker=dict(line=dict(width=1, color='DarkSlateGrey')))
|