PageAI is an AI-powered web design analysis tool that uses Google's Vertex AI to detect and analyze components in web page designs.
PageAI takes a web page mockup image and does two things:
- Detects UI components (buttons, inputs, cards, headings, etc.) using a multimodal LLM, and draws annotated bounding boxes on the image.
- Generates a React + shadcn/ui component from those detections, ready to drop into a shadcn/ui project.
The model provider is pluggable via PAGEAI_PROVIDER=gemini|claude, so you can swap between Vertex AI Gemini and the Anthropic API without touching code.
- Mockup image upload
- Vision-model component detection with bounding-box annotation
- React + shadcn/ui JSX codegen (deterministic skeleton + LLM refinement)
- Pluggable provider abstraction (Gemini by default, Claude optional)
See SCOPE.md for the original roadmap. The current build intentionally narrows that scope to the image-to-JSX loop.
Before you begin, ensure you have met the following requirements:
- Python 3.9+
- A Google Cloud account with Vertex AI API enabled
- A service account key with necessary permissions for Vertex AI
-
Clone the repository:
git clone https://github.com/your-username/pageai.git cd pageai -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your Google Cloud credentials:
- Place your service account key JSON file in the project root
- Create a
.envfile in the project root with the following content:GOOGLE_APPLICATION_CREDENTIALS=./your-service-account-key.json VERTEX_PROJECT_ID=your-project-id VERTEX_LOCATION=us-central1 VERTEX_MODEL_NAME=gemini-1.5-flash-001
Replace
your-service-account-key.jsonandyour-project-idwith your actual values.
-
Start the Flask application:
python app.py
-
Open a web browser and navigate to
http://localhost:8000 -
Upload an image of a web page design
-
View the processed image with detected components and their details
app.py— Flask routes (upload, process, serve image)config.py— Configuration loaded from environmentpageai/— Core packagemodels.py—DetectedComponent,BoundingBoxdataclassesdetection.py— Prompt wiring, response parsing, image annotationcodegen.py— shadcn/ui JSX generator (skeleton + LLM refinement)providers/—GeminiProvider,ClaudeProvider, factoryprompts/— Prompt templates (detection.txt,codegen.txt)
tests/— Pytest suite (offline, no network required)templates/— HTML templatesuploads/— Uploaded and processed images (gitignored)example/— Example processed output.github/workflows/ci.yml— GitHub Actions pytest pipeline
pip install -r requirements.txt
pytestpip install anthropic
export PAGEAI_PROVIDER=claude
export ANTHROPIC_API_KEY=sk-ant-...
# optionally: export ANTHROPIC_MODEL=claude-opus-4-7
python app.pyContributions to PageAI are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a pull request
Distributed under the MIT License. See LICENSE for more information.
Ashutosh Pathak - ashutoshpathak[[[at]]]thenumbercrunchdotcom
Project Link: https://github.com/pathak-ashutosh/PageAI