Downloads · 30 days
0
RHP27042002/AI_NFT_generator
AI_NFT_generator is a text generation model from RHP27042002. Use it when you need the model to write or continue text. It is set up for adapter-transformers. The card lists the license as mit.
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0;
Downloads · 30 days
0
Access
Public
Updated Jul 7, 2023
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 53%
From the Hugging Face model README
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract NFT is ERC721URIStorage { using Counters for Counters.Counter; Counters.Counter private _tokenIds;
address public owner;
uint256 public cost;
constructor(
string memory _name,
string memory _symbol,
uint256 _cost
) ERC721(_name, _symbol) {
owner = msg.sender;
cost = _cost;
}
function mint(string memory tokenURI) public payable {
require(msg.value >= cost);
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
}
function totalSupply() public view returns (uint256) {
return _tokenIds.current();
}
function withdraw() public {
require(msg.sender == owner);
(bool success, ) = owner.call{value: address(this).balance}("");
require(success);
}
}