Gemini 2.0 Flash Image Generation and Editing

R
Renaudil y a 2 jours
0

Description

Generate AI images with the Google Gemini model.

npx boilerapp gemini-2-0-flash-image-generation-and-editing

文档

Gemini 2.0 Flash Image Generation and Editing

Nextjs quickstart for to generating and editing images with Google Gemini 2.0 Flash. It allows users to generate images from text prompts or edit existing images through natural language instructions, maintaining conversation context for iterative refinements. Try out the hosted demo at Hugging Face Spaces.

https://github.com/user-attachments/assets/8ffa5ee3-1b06-46a9-8b5e-761edb0e00c3

Get your GEMINI_API_KEY key here and start building.

How It Works:

  1. Create Images: Generate images from text prompts using Gemini 2.0 Flash
  2. Edit Images: Upload an image and provide instructions to modify it
  3. Conversation History: Maintain context through a conversation with the AI for iterative refinements
  4. Download Results: Save your generated or edited images

Basic request

For developers who want to call the Gemini API directly, you can use the Google Generative AI JavaScript SDK:

const { GoogleGenerativeAI } = require("@google/generative-ai");
const fs = require("fs");

const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);

async function generateImage() {
  const contents =
    "Hi, can you create a 3d rendered image of a pig " +
    "with wings and a top hat flying over a happy " +
    "futuristic scifi city with lots of greenery?";

  // Set responseModalities to include "Image" so the model can generate
  const model = genAI.getGenerativeModel({
    model: "gemini-2.0-flash-exp\

Prix

Gratuit

FREE

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联系我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联系我们,我们将尽快回复。