Screenshot-to-Code is an open-source web app that converts a screenshot into an HTML page styled with TailwindCSS. Written in Python and TypeScript.
It utilizes GPT-4 Vision and DALL-E 3 to analyze screenshots and output clean, editable HTML code. This allows developers to rapidly prototype and build UIs by providing a screenshot, saving significant time and effort. Not just that, it enables you to clone live websites by entering a URL, leveraging the power of Screenshotone API.
How to deploy it:
1. To get started, ensure you have an OpenAI API key with access to the GPT-4 Vision API. Then, follow these steps:
- Install Poetry for package management (
pip install poetry). - Navigate to the backend directory (
cd backend). - Create a
.envfile with your OpenAI API key (echo "OPENAI_API_KEY=sk-your-key" > .env). - Install dependencies (
poetry install). - Activate the virtual environment (
poetry shell). - Launch the FastAPI server (
poetry run uvicorn main:app --reload --port 7001).
2. Frontend setup:
- Navigate to the frontend directory (
cd frontend). - Install dependencies (
yarn). - Start the development server (
yarn dev).
3. If you encounter issues at the poetry install step:
- Navigate to the backend directory (
cd backend). - Create a new
backendfolder inside (mkdir backend). - Move Python files into this new folder (
mv *.py backend/). - Retry the installation (
poetry install). - Enter the new
backenddirectory (cd backend) and launch the server (poetry run uvicorn main:app --reload --port 7000).
4. To use the app, open your browser and go to http://localhost:5173.










