LLM-powered tool that explains code with step-by-step explanations and concise summaries.
Supports both pasting code and uploading files through a sleek web UI.
- 🔍 Explain any code (Python, JS, Java, C++, etc.)
- ✍️ Produce detailed explanations and 2–3 sentence summaries
- 🌐 Modern web frontend with paste + file upload
- 📋 Copy-to-clipboard for all outputs
- ⚡ FastAPI backend powered by Hugging Face LLM
- 🎨 Sleek, minimalistic design with responsive layout
llm-code-explainer/
├── main.py # FastAPI entrypoint
├── requirements.txt # Dependencies
├── render.yaml # Render deployment config
├── Procfile # Alternative deployment
├── README.md # This file
│
├── app/
│ ├── routes.py # API endpoints (/explain)
│ ├── services.py # LLM logic (Hugging Face API)
│ └── __init__.py
│
└── static/
└── index.html # Frontend (modern UI)
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Set your Hugging Face token
export HF_TOKEN="your_huggingface_token_here"# Method 1: Direct Python
python main.py
# Method 2: Uvicorn
uvicorn main:app --reload --port 8000👉 Go to http://localhost:8000
👉 Paste code or upload a file
👉 Get instant explanation + summary
GET /- Main web interfaceGET /healthz- Health checkGET /demo- Demo with sample codeGET /docs- Interactive API documentationPOST /explain/- Upload file for explanationPOST /explain/text- Submit code text for explanation
- Backend: Modify
app/routes.pyfor new endpoints - Frontend: Update
static/index.htmlfor UI changes - LLM Logic: Customize prompts in
app/services.py
# Test health endpoint
curl http://localhost:8000/healthz
# Test demo endpoint
curl http://localhost:8000/demoFrontend: To-Do-List Link
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ using FastAPI + Hugging Face + Modern Web Technologies