Generative Art NFT with Lagrange AI and Chainlink Functions

Sample Outputs

Description

Welcome to the Swan Chain Generative Art NFT project. We used Lagrange APIs and Chainlink Functions to create NFTs for digital arts generated by Lagrange AI. These NFTs are developed on the Mumbai testnets.

Installation

To set up the Generative Art NFT Project, ensure you have a compatible virtual environment. Follow these steps to install the necessary dependencies:

# Clone the repository
git clone https://github.com/TomYang-TZ/Generative-Art-NFT.git

# Navigate to the project directory
cd Generative-Art-NFT  

# Create a virtual environment first
conda create -n "VIRTUAL_ENV_NAME" python=3.9
conda activate "VIRTUAL_ENV_NAME"  

# Run the setup script
chmod +x setup.sh
./setup.sh

Usage

Note that all our functions run locally, your information is not collected. Please remember to use your personal API token from your Lagrange Testnet account as the Lagrange API key. To register for a Multichain Storage(MCS) API key, sign up here and go to setting.

Running Locally

To run the application locally:

  1. Navigate to the Generative-Art-NFT folder:

    cd Generative-Art-NFT 
  2. Start the Flask application:

    python app.py

Running in Docker

To run the application using Docker:

  1. Build the Docker image:

    docker build -t artnft-app .
  2. Run the Docker container:

    docker run -p 9999:9999 artnft-app 

    The Dockerfile is located at Generative-Art-NFT/Dockerfile.

NFT Campaign

To launch our NFT Campaign, which is themed around constellation, advanced technology, cosmic phenomena, and surreal sci-fi environments, we have crafted a comprehensive collection of both positive and negative text prompts. These prompts are systematically selected at random to ensure a diverse and captivating representation in our project. See generate_prompt() for more information. To modify and design your own campain, see below

For Developers

Core Function

The core functionality of this application is encapsulated in the generateArtNFT() function, which can be found in src/utils.py.

Setup

  1. API Configuration:

    • Create a .env file in the root directory.
    • Follow the template provided to set up your API keys and other configurations.
  2. Using the generateArtNFT() Function:

    • Here's an example to illustrate the usage of generateArtNFT():
       mcs_img_link, chainlink_function_contract_address, nft_contract_address, dataset_address, license_mint_hash  = generateArtNFT(POS_TEXT_PROMPT=POS_TEXT_PROMPT, NEG_TEXT_PROMPT=NEG_TEXT_PROMPT)
      )
      You can craft your own text prompts and create unique NFTs using Lagrange AI and Chainlink Functions