An interactive tool that visualizes Python code execution with AI-powered explanations.
- Step-by-step execution visualization
- AI-generated explanations for each step
- Variable state tracking
- Call stack visualization
- Interactive debugging interface
- Frontend: React + TypeScript + Vite + Material UI
- Backend: FastAPI + Python
- AI: CodeLlama 7B (Hugging Face Transformers)
- Code Analysis: Python AST + Execution Tracing
- Python 3.9+
- Node.js 16+
- GPU (recommended for AI explanations)
- Clone the repository:
git clone https://github.com/yourusername/code-visualizer.git
cd code-visualizer- Install backend dependencies:
cd visualizer/backend
pip install -r requirements.txt- Install frontend dependencies:
cd ../frontend
npm install- Start the backend server:
cd visualizer/backend
python main.py- Start the frontend development server:
cd ../frontend
npm run dev- Open http://localhost:3000 in your browser
visualizer/
├── backend/ # Python backend server
│ ├── main.py # FastAPI server
│ ├── explain.py # AI explanation service
│ └── tracer.py # Code execution tracer
├── frontend/ # React frontend
│ ├── src/ # Frontend source code
│ └── public/ # Static assets
├── examples/ # Sample Python code
└── shared/ # Shared utilities
Create a .env file in the backend directory with your Hugging Face token:
HF_TOKEN=your_huggingface_token
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your