OyZa/image-generation-editing
0
Image Creation & Editing with Next.js and Gemini 2.0 Flash
This 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.
How It Works:
- Create Images: Generate images from text prompts using Gemini 2.0 Flash
- Edit Images: Upload an image and provide instructions to modify it
- Conversation History: Maintain context through a conversation with the AI for iterative refinements
- Download Results: Save your generated or edited images
Features
- ๐จ Text-to-image generation with Gemini 2.0 Flash
- ๐๏ธ Image editing through natural language instructions
- ๐ฌ Conversation history for context-aware image refinements
- ๐ฑ Responsive UI built with Next.js and shadcn/ui
- ๐ Seamless workflow between creation and editing modes
- โก Uses Gemini 2.0 Flash Javascript SDK
Getting Started
Local Development
First, set up your environment variables:
cp .env.example .envAdd your Google AI Studio API key to the .env file:
GEMINI_API_KEY=your_google_api_keyThen, install dependencies and run the development server:
npm install
npm run devOpen http://localhost:3000 with your browser to see the application.
Docker Deployment
- Build the Docker image:
docker build -t nextjs-gemini-image-editing .- Run the container with your Google API key:
docker run -p 3000:3000 -e GEMINI_API_KEY=your_google_api_key nextjs-gemini-image-editingOr using an environment file:
# Run container with env file
docker run -p 3000:3000 --env-file .env nextjs-gemini-image-editingOpen http://localhost:3000 with your browser to see the application.
Technologies Used
- Next.js - React framework for the web application
- Google Gemini 2.0 Flash - AI model for image generation and editing
- shadcn/ui - Re-usable components built using Radix UI and Tailwind CSS
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
