Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +2 -0
src/streamlit_app.py
CHANGED
|
@@ -177,8 +177,10 @@ def create_topic_word_bubbles(df_topic_data):
|
|
| 177 |
|
| 178 |
def generate_network_graph(df, raw_text, entity_color_map):
|
| 179 |
"""Generates a network graph visualization (Node Plot) with edges based on entity co-occurrence in sentences."""
|
|
|
|
| 180 |
entity_counts = df['text'].value_counts().reset_index()
|
| 181 |
entity_counts.columns = ['text', 'frequency']
|
|
|
|
| 182 |
unique_entities = df.drop_duplicates(subset=['text', 'label']).merge(entity_counts, on='text')
|
| 183 |
|
| 184 |
if unique_entities.shape[0] < 2:
|
|
|
|
| 177 |
|
| 178 |
def generate_network_graph(df, raw_text, entity_color_map):
|
| 179 |
"""Generates a network graph visualization (Node Plot) with edges based on entity co-occurrence in sentences."""
|
| 180 |
+
df = df.reset_index(drop=True)
|
| 181 |
entity_counts = df['text'].value_counts().reset_index()
|
| 182 |
entity_counts.columns = ['text', 'frequency']
|
| 183 |
+
representative_entities = df.sort_values('score', ascending=False).drop_duplicates(subset=['text'])[['text', 'label', 'score']]
|
| 184 |
unique_entities = df.drop_duplicates(subset=['text', 'label']).merge(entity_counts, on='text')
|
| 185 |
|
| 186 |
if unique_entities.shape[0] < 2:
|