Displaying an approximate graph¶
Often, a prompt contains several tags, for example:
Sunset in a forest ; VRay ; 3D ; High detail
We’ve got two co-occurences:
Edges for this command are weighted, based on an amount of said co-occurences in all available prompts.
To generate and see it, write:
tagnet.py --mode display_graph --path ./prompts
The graph is using Matplotlib and WxWidges and looks like that.
Displaying a web graph¶
# Replace "your_path" with a path containing prompt directory and available for JSON file export # --path is a prompt directory # --output_file is a path to a new JSON output file tagnet.py --path ~/your_path/prompt_directory --mode export_graph --output_file ~/your_path/graph.json
Now you can clone the visualization repository to use it locally and copy the generated
graph.json as a data source.
# Clone a repository git clone firstname.lastname@example.org:6r1d/CLIP_graph_visualized.git cd CLIP_graph_visualized # Copy a graph.json cp ~/your_path/graph.json ./graph.json # Run a Python 3 webserver locally on a 8080 port # (any other webserver with static file support might work) python3 -m http.server --bind 0.0.0.0 8080
Now, by visiting “http://0.0.0.0:8080” or “http://127.0.0.1:8080”, you’ll be able to see your own graph version. The visualizer is using a force-graph library by Vasco Asturiano. It allows you to zoom in and out, see tag names and shift the workspace.