cirediatpl/FigmaChain
소개
FigmaChain은 Figma 디자인을 기반으로 HTML/CSS 코드를 생성하는 Python 스크립트 모음입니다. OpenAI의 GPT-3 모델을 사용해 Figma 디자인 입력으로부터 HTML/CSS 코드를 빠르게 생성할 수 있습니다. 대화형 코드 생성을 위한 Streamlit 기반 챗봇 인터페이스도 포함되어 있습니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalFigmaChain: HTML/CSS Code Generation from Figma Designs
FigmaChain is a set of Python scripts that generate HTML/CSS code based on Figma designs. Using OpenAI's GPT-3 model, FigmaChain enables developers to quickly generate HTML/CSS code from a Figma design input. It also includes a Streamlit-based chatbot interface for interactive code generation.
Prerequisites
- Python 3.6 or higher
- An OpenAI API key (set as environment variable
OPENAI_API_KEY) - Access token, node IDs, and file key for Figma (set as environment variables
ACCESS_TOKEN,NODE_IDS, andFILE_KEY)
Accessing the Figma RESTful API
To access the Figma RESTful API, you will need an access token, node IDs, and a file key.
- File Key: The file key can be pulled from the URL of the Figma design file. For example, the file key in the URL
https://www.figma.com/file/{filekey}/sampleFilenameis{filekey}. - Node IDs: Node IDs are also available in the URL. Click on any element in the Figma design file and look for the
?node-id={node_id}parameter in the URL. - Access Token: Instructions for obtaining an access token can be found in the Figma help center article: https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens
Installation
- Clone the repository to your local machine.
- Navigate to the project directory.
- Install the required Python packages: pip install openai langchain streamlit dotenv
- Create a
.envfile in the project directory and add the following environment variables: OPENAI_API_KEY, ACCESS_TOKEN, NODE_IDS, FILE_KEY
Usage
generateCode.py
This script generates HTML/CSS code based on a user-provided input and a Figma design.
- Navigate to the project directory.
- Run the script with the desired input text as a command-line argument: python generateCode.py input_text
- The script generates HTML/CSS code and saves it to an
output.htmlfile. - The script opens the generated HTML file in the default web browser.
chatbot.py
This is the chatbot code.
- Start the Streamlit app: streamlit run chatbot.py
- Enter your input in the chat interface and receive generated HTML/CSS code.
- The generated code is rendered on the page and the conversation is displayed.
Sponsors
✨ Learn to build projects like this one (with an early bird discount): BuildFast Course
License
관련 프로젝트 살펴보기
불러오는 중…