A simple AI-powered Sketch → HTML Code Generator built using Python and Flask. This project converts hand-drawn UI sketches into structured HTML code using computer vision and generative AI.
- Upload hand-drawn UI sketches
- Object detection for UI components
- AI-generated HTML layout
- Live preview of generated code
- Flask-based web interface
- Easy-to-extend architecture
- Python
- Flask
- OpenCV
- PyTorch (model inference)
- Google Generative AI (Gemini)
- HTML / CSS
s2c/
│
├── app.py # Main Flask application
├── detector.py # UI element detection logic
├── generator.py # Code generation logic
├── run_detection.py # Detection runner
├── templates/ # HTML templates
├── uploads/ # Uploaded images
├── requirements.txt # Project dependencies
├── .gitignore
└── README.md
git clone https://github.com/jmanasareddy12/Sketch-to-code.git
cd Sketch-to-codepython -m venv venvActivate:
Windows
venv\Scripts\activateLinux/Mac
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
GOOGLE_API_KEY=your_api_key_here
python app.pyOpen your browser:
http://127.0.0.1:5000
- Upload a sketch image
- Detection model identifies UI components
- AI generates HTML layout
- Preview generated result live in browser
- Better UI component detection
- Drag-and-edit generated layouts
- Export to React / Tailwind
- Improved styling generation
- Deployment support
J Manasa Reddy M Preety Devi
- Inspired by Microsoft Sketch2Code concept
- Powered by modern AI and computer vision tools
- Developed collaboratively by J. Manasa Reddy and M. Preety Devi