CoolFace
Apppublic

SWAG456/image-generation-editing

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
2likes
README.md91 linesDownload Raw Back to root
1---2title: Image Generation & Editing3emoji: ๐Ÿ–ผ๏ธ4colorFrom: blue5colorTo: blue6sdk: docker7header: mini8app_port: 30009pinned: false10license: apache-2.011short_description: Generate and Edit images with Gemini 2.012---13 14 15# Image Creation & Editing with Next.js and Gemini 2.0 Flash16 17This project demonstrates how to create and edit images using Google's Gemini 2.0 Flash AI model in a Next.js web application. It allows users to generate images from text prompts or edit existing images through natural language instructions, maintaining conversation context for iterative refinements.18 19**How It Works:**20 211. **Create Images**: Generate images from text prompts using Gemini 2.0 Flash222. **Edit Images**: Upload an image and provide instructions to modify it233. **Conversation History**: Maintain context through a conversation with the AI for iterative refinements244. **Download Results**: Save your generated or edited images25 26## Features27 28- ๐ŸŽจ Text-to-image generation with Gemini 2.0 Flash29- ๐Ÿ–Œ๏ธ Image editing through natural language instructions30- ๐Ÿ’ฌ Conversation history for context-aware image refinements31- ๐Ÿ“ฑ Responsive UI built with Next.js and shadcn/ui32- ๐Ÿ”„ Seamless workflow between creation and editing modes33- โšก Uses Gemini 2.0 Flash Javascript SDK34 35## Getting Started36 37### Local Development38 39First, set up your environment variables:40 41```bash42cp .env.example .env43```44 45Add your Google AI Studio API key to the `.env` file:46 47```48GEMINI_API_KEY=your_google_api_key49```50 51Then, install dependencies and run the development server:52 53```bash54npm install55npm run dev56```57 58Open [http://localhost:3000](http://localhost:3000) with your browser to see the application.59 60### Docker Deployment61 621. Build the Docker image:63 64```bash65docker build -t nextjs-gemini-image-editing .66```67 682. Run the container with your Google API key:69 70```bash71docker run -p 3000:3000 -e GEMINI_API_KEY=your_google_api_key nextjs-gemini-image-editing72```73 74Or using an environment file:75 76```bash77# Run container with env file78docker run -p 3000:3000 --env-file .env nextjs-gemini-image-editing79```80 81Open [http://localhost:3000](http://localhost:3000) with your browser to see the application.82 83## Technologies Used84 85- [Next.js](https://nextjs.org/) - React framework for the web application86- [Google Gemini 2.0 Flash](https://deepmind.google/technologies/gemini/) - AI model for image generation and editing87- [shadcn/ui](https://ui.shadcn.com/) - Re-usable components built using Radix UI and Tailwind CSS 88 89## License90 91This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICENSE) file for details.