Code Monkey home page Code Monkey logo

template-ai-pfp-app's Introduction

banner

⚑ TurboETH

TS GPLv3 license

Turbo ETH is an Ethereum dApp Build System; designed to make building Web3 applications fast.

Deploy with Vercel

Installation & Usage

git clone [email protected]:turbo-eth/turbo-eth.git

Installation

pnpm is the recommended package manager.

pnpm install

Local Development

pnpm lab

Local Development w/ Blockchain Fork

pnpm lab:fork

Build

pnpm build

Tests

pnpm test

Modules

The monorepo includes 3 primary folders.

Each folder contains similar modules i.e. frontend applications go in the apps folder and the smart contracts go in the contracts folder; very straight-forward.

Environment Variables

Each module requires unique environment variables. Specifically the apps and contracts modules when preparing for deployment or forking a blockchain network.

The .env.example can be copied/pasted and updated to include the required variables deployment.

Task Pipelines

Builds, tests and deployments are handled via tasks pipelines. Task pipelines orchestrate build and dependency requirements between mono-repo packages.

Edit the turbo.json file in the root directory to add new pipelines and custom workflows.

Developer Experience

The TurboETH build system uses Turborepo and pNPM; a high-performance build system and a fast, disk space efficient package manager. Giving developers the best experience possible while minimizing demand on local compute resources.

Core Technologies


Copyright 2022 Kames Geraghty

template-ai-pfp-app's People

Contributors

kamescg avatar

Watchers

 avatar  avatar

template-ai-pfp-app's Issues

Bounty: Create ERC721 AI PFP/NFT

Create an ERC721 AI PFP/NFT using the Solbase smart contract library.

Required Functionality:

  • Ownable
  • Minting controlled by the Access Control NFT - #2
  • Unique Image for each NFTs (hosted on IPFS or Arweave)
  • Token owner can update image with new image URI at any point.

The TurboETH Bank template demonstrates how to inherit the Solbase ERC721 and Owned smart contracts.

How It Could Work

The smart contract could be designed in a couple of different ways. Below is my recommendation, but anyone is welcome to recommend a better alternative.

Minting

The ERC721 AI PFP/NFT smart contract will be initialized with the Access Control NFT smart contract address during deployment.

The acNFT.tokenId will be used to map to an isMinted boolean mapping in the pfpNFT smart contract storage.

IF the tokenId hasn't been used, and is owned by the caller, allow a new NFT to be minted.

IF the tokenId has been used or is not owned by the caller, do not allow an NFT to be minted.

Upload PFP

When the user is minting/updating the pfpNFT they should be able to pass an image URI in the function arguments.

function mint(address to, string imageURI) external returns (uint256) {
  ....
}

function update(string imageURI) external {
  ....
}

πŸ’° 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

Bounty: Create ERC721 Access Control NFT

Create an ERC721 Access Control NFT using the Solbase smart contract library.

Required Functionality:

  • Ownable
  • Unlimited Mints
  • Fixed price to mint i.e. 10 USDC
  • Single Image for all NFTs hosted on IPFS or Arweave

The TurboETH Bank template demonstrates how to inherit the Solbase ERC721 and Owned smart contracts.

Why

Each tokenId will be allowed to trigger, only once, an offchain API for generating a AI models using uploaded images of the person who purchased the NFT.

πŸ’° 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

Bounty: PFP Image Uploading using UploadThing

Add an image uploading service using the UploadThing service and packages.

Required Functionality

  • Upload Images (jpg, jpeg and png)
  • Retrieve Images
  • Core functionality should be contained in a TurboETH Integration.

How It Could Work

Follow the UploadThing documentation to create a file upload API for the Next13 app router -- used by the TurboETH Web3 app template.

The file uploads should be restricted to authenticated users who have minted an acNFT.

File uploads should be associated with the user account in the application database.

πŸ’° 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

Bounty: Dreambooth/Stablediffusion API Integration using Replicate

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

User Story: AI + NFT Web3 Application (Ethereal Nexus)

πŸ‘¨β€πŸ’» User Story

As a player in the Web3 universe I want a unique profile picture (PFP) generated using artificial intelligence.

More specifically I want to use a Dreambooth API to generate profile pictures that is minted as a 1-of-1 non-fungible token (NFT) hosted using distributed storage like IPFS and/or Arweave.

πŸ“œ Disclaimer

To be eligible for the payout you must first get approval to work on the bounty.

It's recommended to share a link to your personal Github account.

🧱 Project

Create a Web3 application that combines Dreambooth AI and ERC721 NFTs.

The application should allow users to generate personalized "Web3 Metaverse" profile pictures.

The PFPs will be generated using Dreambooth, which is AI program that can be trained on object, like a person, and recreate that object in a variety of different environments. The NFT will be minted on the Optimism network, which is a popular Ethereum rollup and permantely stored on either IPFS or Arweave.

Application Features

  1. Purchase NFT Access Control Pass
    User are required to purchase an access control NFT for 10 USDC. The cost of the NFT will be used to run the servers required to generate the AI profile pictures.

The access control NFT is separate from the PFP NFT. And is used as solely as purchase receipt and as an API access control trigger.

  1. Upload Images to Server
    User should be able to upload 5-10 photos of themselves on a private server. The images should be stored in Vercel object storage and be erased after the PFP has been generated.

  2. Generate AI Profile Pictures
    User should be able to generate 100 unique profile pictures using a model trained on the upload images in the previous step. Users can save all of the hi-res images at no additional cost.

  3. Select Favorite & Mint on Blockchain
    Users should be able to select a single PFP, which will be uploaded to IPFS or Arweave, and minted on the Optimism L2 rollup.

Required Functionality:

  1. Dreambooth API Integration
  2. ERC721 Access Control Smart Contract
  3. ERC721 PFP Smart Contract
  4. IPFS Image Upload

Developer Tasks:

  • Create turbo monorepo using TurboRepo
  • Clone TurboETH Web3 Application template main branch.
  • Clone TurboETH smart contract boilerplate.
  • Create ERC721 Access Control NFT using Solbase (smart contracts)
  • Create ERC721 AI PFP NFT using Solbase (smart contracts)
  • Create Image Upload Service (application)
  • Create API that communicates with external Dreambooth API (application)

Example Application Template

The Places TurboETH template is good example of how to setup a turbo monorepo that includes independent TurboETH application and smart contract packages.

The WAGMI CLI is used to connect the application and smart contracts. React read, write and events are automatically generated.

Mockups

The initial mockups and ideas are available on Figma and are free to download, copy and update.

combo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.