This is a locally running AI Image Generator built using Hugging Face Inference API and Node.js/Express.
The project is designed for learning purposes, so you can explore how AI image generation works, practice frontend-backend integration, and understand responsive design — all without deploying anything online.
It's perfect for anyone who wants to experiment locally and learn how to run a full-stack AI project on their own machine.
- User enters a text prompt or selects a random example prompt.
- User chooses a model, image count, and aspect ratio.
- Frontend sends a POST request to the backend
/api/generateendpoint. - Backend uses Hugging Face API to generate images.
- Generated images are returned as Base64 and displayed in the gallery.
- Backend: Node.js, Express, dotenv, CORS
- Frontend: HTML, CSS, JavaScript
- AI API: Hugging Face Inference API (Nebius provider)
- Others: Font Awesome icons for UI, responsive CSS grid
- AI Image Generation: Generate images from text prompts using Hugging Face models.
- Local Server: Express server (
server.js) handles API requests locally. - Responsive Frontend: Dynamic gallery, image cards, and grid layout adapt to any screen size.
- Interactive UI: Select model, image count, and aspect ratio; click "Generate" to see results instantly.
- Light/Dark Mode: Toggle themes and persist preference using localStorage.
- Image Download: Download generated images directly from the gallery.
- Learning-Oriented: Designed to help you practice and understand:
- Local API setup with Express
- Frontend-backend communication
- Handling base64 images in JavaScript
- Responsive CSS grids and interactive UI elements
- Managing state, async operations, and error handling in JS
- Clone the repository:
git clone https://github.com/username/ai-image-generator.git
