Download scripts/3.11_connect_the_dots.py from SlappAI/Singularity: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/SlappAI/Singularity/resolve/main/scripts/3.11_connect_the_dots.py
- Command line
-
hf download hf://SlappAI/Singularity/scripts/3.11_connect_the_dots.py
-
curl -L -o 3.11_connect_the_dots.py https://huggingface.co/SlappAI/Singularity/resolve/main/scripts/3.11_connect_the_dots.py
1.03 kB
| import os | |
| import sys | |
| import json | |
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| # Path setup | |
| sys.path.append(os.path.join(os.path.dirname(__file__), "../")) | |
| from app.services.agn_service.build_expanded_graph import build_expanded_graph | |
| from app.services.agn_service.visualize_graph import visualize_graph | |
| # Paths to files | |
| index_file_path = "graphs/config.json" # Use the updated config file | |
| output_image = "expanded_graph_visualization.png" | |
| # Load index data | |
| def load_index_data(file_path): | |
| with open(file_path, "r") as file: | |
| return json.load(file) | |
| # Main execution to build and visualize the expanded graph | |
| if __name__ == "__main__": | |
| # Load index data from the config | |
| data = load_index_data(index_file_path) | |
| # Build the graph using the updated build_graph function | |
| G = build_expanded_graph(data) | |
| if G: | |
| visualize_graph(G, output_file=output_image) | |
| print(f"Expanded graph visualization saved as {output_image}") | |
| else: | |
| print("Failed to build expanded graph.") |