Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -126,23 +126,25 @@ def main():
|
|
126 |
collapsible=True)
|
127 |
|
128 |
|
129 |
-
|
130 |
if sensors: # Check if there are sensors to display
|
131 |
st.header("Building Sensor Network")
|
132 |
graph_store = TripleStore()
|
133 |
building_name = f"{data['buildings'][selected_index]['type']} ({selected_building_coords[0]}, {selected_building_coords[1]})"
|
134 |
|
135 |
-
#
|
136 |
for sensor in sensors:
|
137 |
sensor_id = f"Sensor: {sensor}" # Label for sensor nodes
|
138 |
-
#
|
139 |
-
graph_store.add_triple(
|
140 |
|
141 |
# Configuration for the graph visualization
|
142 |
agraph_config = Config(height=600, width=600, nodeHighlightBehavior=True, highlightColor="#F7A7A6", directed=True, collapsible=True)
|
143 |
|
144 |
# Display the graph
|
145 |
-
agraph(nodes=
|
|
|
|
|
146 |
|
147 |
"""
|
148 |
|
|
|
126 |
collapsible=True)
|
127 |
|
128 |
|
129 |
+
|
130 |
if sensors: # Check if there are sensors to display
|
131 |
st.header("Building Sensor Network")
|
132 |
graph_store = TripleStore()
|
133 |
building_name = f"{data['buildings'][selected_index]['type']} ({selected_building_coords[0]}, {selected_building_coords[1]})"
|
134 |
|
135 |
+
# Iterate through each sensor and create a triple linking it to the building
|
136 |
for sensor in sensors:
|
137 |
sensor_id = f"Sensor: {sensor}" # Label for sensor nodes
|
138 |
+
# Correctly add the triple without named arguments
|
139 |
+
graph_store.add_triple(building_name, "has_sensor", sensor_id)
|
140 |
|
141 |
# Configuration for the graph visualization
|
142 |
agraph_config = Config(height=600, width=600, nodeHighlightBehavior=True, highlightColor="#F7A7A6", directed=True, collapsible=True)
|
143 |
|
144 |
# Display the graph
|
145 |
+
agraph(nodes=graph_store.getNodes(), edges=graph_store.getEdges(), config=agraph_config)
|
146 |
+
|
147 |
+
|
148 |
|
149 |
"""
|
150 |
|