AD2000X commited on
Commit
d9d243e
·
verified ·
1 Parent(s): 9d5fcd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -262,17 +262,21 @@ def run_entity_exploration():
262
  )
263
 
264
  if neighborhood and "neighbors" in neighborhood:
 
265
  for distance in range(1, max_distance+1):
266
  neighbors_at_distance = [n for n in neighborhood["neighbors"] if n["distance"] == distance]
267
 
268
  if neighbors_at_distance:
269
- with st.expander(f"Neighbors at Distance {distance} ({len(neighbors_at_distance)})"):
270
- for neighbor in neighbors_at_distance:
271
- st.markdown(f"**{neighbor['id']}** ({neighbor.get('class_type', 'unknown')})")
272
- for relation in neighbor.get("relations", []):
273
- direction = "→" if relation["direction"] == "outgoing" else "←"
274
- st.markdown(f"- {direction} {relation['type']}")
275
- st.markdown("---")
 
 
 
276
 
277
  elif not entities:
278
  st.warning("No entities found in the ontology.")
 
262
  )
263
 
264
  if neighborhood and "neighbors" in neighborhood:
265
+ lines = []
266
  for distance in range(1, max_distance+1):
267
  neighbors_at_distance = [n for n in neighborhood["neighbors"] if n["distance"] == distance]
268
 
269
  if neighbors_at_distance:
270
+ lines.append(f"**Neighbors at Distance {distance} ({len(neighbors_at_distance)})**")
271
+ for neighbor in neighbors_at_distance:
272
+ lines.append(f"- **{neighbor['id']}** ({neighbor.get('class_type', 'unknown')})")
273
+ for relation in neighbor.get("relations", []):
274
+ direction = "→" if relation["direction"] == "outgoing" else "←"
275
+ lines.append(f" - {direction} {relation['type']}")
276
+ lines.append("---")
277
+ with st.expander("Show Neighbor Details", expanded=False):
278
+ for line in lines:
279
+ st.markdown(line)
280
 
281
  elif not entities:
282
  st.warning("No entities found in the ontology.")