Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounty: Dreambooth/Stablediffusion API Integration using Replicate #5

Open
kamescg opened this issue May 19, 2023 · 0 comments
Open

Comments

@kamescg
Copy link
Member

kamescg commented May 19, 2023

Create an API endpoint for generating unique profile pictures using Dreambooth API service on Replicate.

https://replicate.com/replicate/dreambooth

How It Could Work

Model Request

The API will zip the images uploaded by the user (#4) and send a q request to the replicate API to generate a new model.

import Replicate from "replicate";

const replicate = new Replicate({
  auth: process.env.REPLICATE_API_TOKEN,
});

const output = await replicate.run(
  "replicate/dreambooth:a8ba568da0313951a6b311b43b1ea3bf9f2ef7b9fd97ed94cebd7ffd2da66654",
  {
    input: {
      instance_prompt: "..."
    }
  }
);

The prompts will be pre-generated and available in the backend as hardcoded values.

Complete Webhook

Once the model and images have been generated the replicate API will call an application webhook.

Example of Webhook Configration

const prediction = await replicate.predictions.create({
  version: "a8ba568da0313951a6b311b43b1ea3bf9f2ef7b9fd97ed94cebd7ffd2da66654",
  input: {
    instance_prompt: "..."
  },
  webhook: "https://example.com/your-webhook",
  webhook_events_filter: ["completed"]
});

Replace your-webhook with api/pfp-complete and create a function in the application apps/api/pfp-complete/route.ts that updates the user account with the new images and toggles the isComplete status for profile picture generation.

💰 Bounty Reward

The bounty reward is undetermined. Comments and feedback are welcome.

TurboETH is the recipient of 18,271.88 OP Tokens from Optimism Retroactive Public Goods Funding. The OP tokens earned from the PGF program are the primary funding source for TurboETH bounties.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Todo
Development

No branches or pull requests

1 participant