Spaces:
Running
Word to Code
This is a Next.js project that transforms natural language descriptions into visual code sketches.
π€ HuggingFace Space Setup
- Clone the repository:
git clone https://huggingface.co/spaces/tinazone/word-to-code
cd word-to-code
Set up your environment variables:
- Go to your HuggingFace Space's Settings tab
- Under "Repository Secrets", add a new secret:
- Name:
GEMINI_API_KEY
- Value: Your Gemini API key from https://ai.google.dev/
- Name:
- The secret will be securely passed to the container at runtime
Make your changes and push them back:
git add .
git commit -m "Update space"
git push
Note: When pushing, use a HuggingFace access token with write permissions as your password. Generate one from: https://huggingface.co/settings/tokens
π¨ Space Configuration
title: Word to Code - Visual Code Sketch Generator emoji: π¨ colorFrom: blue colorTo: purple sdk: docker pinned: false app_port: 3000
Local Development
- Create a
.env.local
file in the root directory:
GEMINI_API_KEY=your_api_key_here
- Install dependencies:
npm install
- Run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
Features
- Transform natural language descriptions into visual code sketches
- Download sketches as GIF animations
- Real-time code generation and visualization
- Modern, responsive UI
Technical Stack
- Next.js 14
- React 18
- Tailwind CSS
- P5.js for sketching
- FFmpeg for GIF generation
- Gemini 2.0 for code generation
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
This project uses next/font
to automatically optimize and load Geist, a new font family for Vercel.
Learn More
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
Deploy on Vercel
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.