Spaces:
Runtime error
Runtime error
display filtered dataframe
Browse files
app.py
CHANGED
|
@@ -17,11 +17,11 @@ class LoadData:
|
|
| 17 |
|
| 18 |
# add code titles to train data
|
| 19 |
merged = train.merge(titles, left_on="context", right_on="code")
|
| 20 |
-
train_df = merged[['id', '
|
| 21 |
|
| 22 |
# add relations / edges for knowledge graph
|
| 23 |
train_kg: pd.DataFrame = train_df.copy()
|
| 24 |
-
train_kg['relation'] = train_kg['
|
| 25 |
|
| 26 |
|
| 27 |
class App:
|
|
@@ -83,7 +83,8 @@ class Helper(App):
|
|
| 83 |
|
| 84 |
# create PyVis network from the graph data
|
| 85 |
self.pyvis_network(nodes, edge_labels)
|
| 86 |
-
st.write(f"> sample size: {sample.shape[0]}")
|
|
|
|
| 87 |
|
| 88 |
def pyvis_network(self, nodes, edge_labels):
|
| 89 |
|
|
|
|
| 17 |
|
| 18 |
# add code titles to train data
|
| 19 |
merged = train.merge(titles, left_on="context", right_on="code")
|
| 20 |
+
train_df = merged[['id', 'anchor', 'context', 'target', 'title', 'score']].copy()
|
| 21 |
|
| 22 |
# add relations / edges for knowledge graph
|
| 23 |
train_kg: pd.DataFrame = train_df.copy()
|
| 24 |
+
train_kg['relation'] = train_kg['context'] + " || " + train_kg['title'] + " || " + train_kg['score'].astype(str)
|
| 25 |
|
| 26 |
|
| 27 |
class App:
|
|
|
|
| 83 |
|
| 84 |
# create PyVis network from the graph data
|
| 85 |
self.pyvis_network(nodes, edge_labels)
|
| 86 |
+
st.write(f"> the visualized sample size: {sample.shape[0]}")
|
| 87 |
+
st.write(sample)
|
| 88 |
|
| 89 |
def pyvis_network(self, nodes, edge_labels):
|
| 90 |
|