Prototype: Create a Website from a Screenshot and Refine It, All in the Browser

I’ve been working on this experiment, combining OpenAI’s gpt-4-vision-preview with WordPress Playground to create a website based on a screenshot.

This follows on the heels of Matt Mullenweg’s announcement at the 2023 State of the Word that in 2024, the WordPress project wants to work on Data Liberation.

While the typical approach to migrating data is to build importers for specific services, a truely universal migration could happen through screenshots. With AI vision this might now be in reach.

So I built this prototype that combines a OpenAI-powered chat interface with WordPress Playground. First a screenshot, a screen recording further down.

So this is only a start. The website somewhat resembles the screenshot but it’s far from being pixel perfect.

My idea is that you’ll work together with the assistant in refining the site. It can help you update, you can ask it questions. An import is rarely perfect from the start but you can see and test the result right away in the browser and refine it.

I imagine that when done, you can then transfer the site to a web hoster who from then on can host your website for everyone.

You can try this yourself here, you “just” need an OpenAI API key that will be stored in your local storage: https://akirk.github.io/website-liberator/

Source (very unpolished) at https://github.com/akirk/website-liberator/

Some notes on this first implementation:

  • Every message is a new conversation. Modifying a website can be token intense, so for now it cannot refer to previous messages.
  • It’s using function calling to allow OpenAI to gather more information to fulfil the request.
  • Chosing the right functions to provide can be tricky.
  • It uses different models depending on the task. gpt4-vision-preview for the screenshot, gpt-3.5-turbo for the rest. I need to experiment more with gpt-4 for the latter tasks.

Finally, a screen recording of an early iteration, I have since moved the chat to the right side.

As I’ve been working on the prototype, it has shown to be interesting to have the bot be there just for customizing sites, it can create and modify pages, update settings of the website. Maybe install plugins.

So starting with a basis from screenshots and imported data, it might just be able to assist you to arrive at a comparable WordPress website, and all with the ease and effortless setup of WordPress Playground. I wonder where we can take this!

Bonus

Some screenshots from a recent version:

cll: Adding unix pipe support

Today I’ve added a little feature to my cll tool (which I renamed again but I think now I’ll stick to this) so that it can process stdin so that you can do stuff like this:

echo 'a presentation about the friends plugin for wordpress' | cgt -s 'Please create a reveal.js presentation based on the following notes. Ensure to use short titles and short few words on each list item. Please load the moon theme and scripts from the cdn.jsdelivr.net domain, dont use any reveal.js plugins. Respond with just the HTML, no outside comments.' > presentation.html

Which creates a presentation.html file that contains a full Reveal.js presentation on the topic.

The systems prompt will tell the model how to behave so that you can also (granted it doesn’t always work but it’s gotten better) tell it to output JSON which you can then parse:

echo hello | cll -mllama2 -s 'please respond only in valid json' | jq .
{
  "message": "hello",
  "type": "text"
}

In “stdin mode,” it will only output the response from the LLM, you can turn that back on using -v (as in verbose) although that additional output will go to stderr.