draw-a-ui README

The project's README from github.com/SawyerHood/draw-a-ui. As one markdown file: README.md.

draw-a-ui

This is an app that uses tldraw and the gpt-4-vision api to generate html based on a wireframe you draw.

The spiritual successor to this project is Terragon Labs.

A demo of the app

This works by just taking the current canvas SVG, converting it to a PNG, and sending that png to gpt-4-vision with instructions to return a single html file with tailwind.

Disclaimer: This is a demo and is not intended for production use. It doesn't have any auth so you will go broke if you deploy it.

Getting Started

This is a Next.js app. To get started run the following commands in the root directory of the project. You will need an OpenAI API key with access to the GPT-4 Vision API.

Note this uses Next.js 14 and requires a version of node greater than 18.17. Read more here.

echo "OPENAI_API_KEY=sk-your-key" > .env.local
npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.

draw-a-ui (SawyerHood/draw-a-ui)

Searching Database…

13.6K ·GitHub
这是什么?一个可以在画布上绘制 UI 线框图的应用,它会借助 GPT-4 Vision,根据你的草图生成一个可用的 HTML 页面(使用 Tailwind 样式)。
它到底是怎么把我的草图变成 HTML 的?它会把当前画布导出为 SVG,再转换成 PNG,然后把这张图片连同指令一起发送给 GPT-4 Vision,要求它返回一个使用 Tailwind 样式的单个 HTML 文件。
我该怎么运行它?这是一个 Next.js 应用:在项目根目录下安装依赖并运行开发命令,然后在浏览器中打开即可。
运行之前我需要准备什么?你需要一个可以调用 GPT-4 Vision API 的 OpenAI API 密钥。另外,由于项目使用 Next.js 14,需要 Node.js 18.17 以上版本。
我可以把它部署出去给别人用吗?不安全。它明确只是一个没有身份验证的演示项目,因此如果公开部署,任何人都可能用你的密钥消耗 OpenAI API 费用。
它在哪里运行?它以本地网页应用的形式在浏览器中运行,基于 Next.js 构建。
画布用的是什么绘图工具?它使用 tldraw 作为绘制草图的画布,tldraw 是一个开源的无限画布库。
有没有值得一看的后续项目?README 中提到,这个项目的精神续作是 Terragon Labs。
画完一张草图后我会得到什么?你会得到一个使用 Tailwind CSS 样式的 HTML 文件,它大致还原你画的线框图。
Creator
SawyerHood
Size
1 MB
Stars
13.6K
Updated
CommitJul 26
Age
2y
Commits · 90 Days