Turn your codebase into stunning visual representations with AI-powered image generation.
CodeBase Visualizer analyzes your code and transforms it into beautiful, informative visualizations using Stable Diffusion. This tool parses your codebase structure, extracts meaningful relationships, and generates images that represent your code as various metaphorical ecosystems - from futuristic cityscapes to holographic maps to biodigital forests.
- Automatic Code Analysis: Parses class hierarchies, methods, and relationships in .NET/C# codebases
- Customizable Visualization Styles: Multiple visualization themes including:
- Biodigital Forest Ecosystem
- Neural Metropolis (Cyberpunk City)
- Data Crystal Matrix
- Futuristic Holographic Map
- Relationship Modeling: Visualizes code dependencies and interactions
- GPU-Accelerated: Utilizes CUDA for high-quality image generation
- Python 3.7+
- PyTorch with CUDA support
- Diffusers library
- NVIDIA GPU with CUDA support (recommended)
# Clone the repository
git clone https://github.com/karthyick/codebase-visualizer.git
cd codebase-visualizer
# Create and activate a virtual environment
python -m venv codebase_visualizer_venv
source codebase_visualizer_venv/bin/activate # On Windows: codebase_visualizer_venv\Scripts\activate
# Install dependencies
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install diffusers transformers tqdmpython main.py --code_dir /path/to/your/codebasepython main.py --help--code_dir: Path to the code directory to analyze--output_dir: Directory to save generated images (default: ./generated_images/)--skip_individual: Skip individual image generation--skip_unified: Skip unified ecosystem visualization--batch_size: Batch size for image generation (default: 4)--force_cpu: Force CPU execution (very slow, not recommended)--fix_cuda: Run diagnostics to troubleshoot CUDA issues
If you're experiencing CUDA issues, run:
python main.py --fix_cudaFollow the recommendations to install the correct PyTorch version for your CUDA installation.
Represents classes as trees and methods as birds in a vibrant digital forest ecosystem.
Visualizes your codebase as a futuristic cyberpunk city with classes as skyscrapers and methods as drones.
Displays code elements as a complex crystalline structure with glowing connections.
Presents your code as an advanced holographic projection with interactive elements and data flows.
To use different visualization styles, modify the ecosystem_prompt variable in the generate_unified_visualization function in main.py. Sample prompts are included in the code.
The tool generates:
parsed_code/codebase_data.json: Analysis of your codebase structureparsed_code/descriptions.json: Generated descriptions for visualizationgenerated_images/: Directory containing generated visualizationsgenerated_images/codebase_ecosystem.png: Main unified visualization
After generation, you can view the results using the included Streamlit app:
pip install streamlit pandas pillow matplotlib networkx
streamlit run app.pyMIT
This project uses Stable Diffusion for image generation and draws inspiration from various code visualization techniques.

