Jon-Becker / nft-generator-py

This tool allows users to generate sets of unique images and metadata using weighted layer collections.
MIT License
304 stars 127 forks source link

Problem with generating images #58

Closed PenguinRevolutionYT closed 10 months ago

PenguinRevolutionYT commented 11 months ago

I'm having an issue with generating images, The problem seems to be in main.py

Here is the error

python3 main.py generate  --config config.json --amount 100

Traceback (most recent call last):
  File "/home/alan/Pictures/Phunks/nft-generator-py/main.py", line 66, in <module>
    generator: Generator = Generator(**args)
  File "/home/alan/Pictures/Phunks/nft-generator-py/src/core/main.py", line 35, in __init__
    self.config = read_json(args["config"])
  File "/home/alan/Pictures/Phunks/nft-generator-py/src/utils/io.py", line 14, in read_json
    config = json.load(f)
  File "/usr/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ':' delimiter: line 15 column 46 (char 509)

When I take off the "--amount" flag I get this error

python3 main.py generate  --config config.json 

Traceback (most recent call last):
  File "/home/alan/Pictures/Phunks/nft-generator-py/main.py", line 66, in <module>
    generator: Generator = Generator(**args)
  File "/home/alan/Pictures/Phunks/nft-generator-py/src/core/main.py", line 26, in __init__
    raise ValueError("No amount was provided.")
ValueError: No amount was provided.

Here is my config file


{
  "layers": [
    {
      "name": "Type",
      "values": ["Male", "Ape", "Zombie", "Alien"],
      "trait_path": "./Phunk-Test/Type",
      "filename": ["Male", "Ape", "Zombie", "Alien"],
      "weights": [70, 10, 7, 3]
    },
    {
      "name": "Eyes",
      "values": ["3D Glasses", "Big Glasses", "Classic Glasses", "Clown Eyes", "Eye Mask",
      "Eye Patch", "Horned Rim Glasses", "Nerd Glasses", "Shades", "VR"],
      "trait_path": "./Phunk-Test/Eyes",
      "filename": "3D_Glasses", "Big_Glasses", "Classic_Glasses", "Clown_Eyes", "Eye_Mask",
      "Eye_Patch", "Horned_Rim_Glasses", "Nerd_Glasses", "Shades", "VR"],
      "weights": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
    },
    {
      "name": "Hair",
      "values": ["Bandana", "Cap", "Clown Hair", "Crazy Violet Hair", "Fedora", "Headband", "Knitten Cap",
      "Mohawk_Dark", "Police Cap"],
      "trait_path": "./Phunk-Test/Hair",
      "filename": ["Bandana", "Cap", "Clown_Hair", "Crazy_Violet_Hair", "Fedora", "Headband", "Knitten_Cap",
      "Mohawk_Dark", "Police_Cap"],
      "weights": [20, 10, 10, 10, 10, 10, 10, 10, 10]
    },
    {
      "name": "Facial Hair",
      "values": ["Chin Strap", "Front Beard Dark", "Front Beard", "Moustache", "Muttonchops",
      "Normal Beard Black", "Normal Beard", "Handlebar"],
      "trait_path": "./Phunk-Test/Facial_Hair",
      "filename": ["Chin_Strap", "Front_Beard_Dark", "Front_Beard", "Moustache", "Muttonchops",
      "Normal_Beard_Black", "Normal_Beard", "Handlebar"],
      "weights": [12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 12.5]
    },
    {
      "name": "Face",
      "values": ["Clown Nose", "Frown", "Mole", "Smile"],
      "trait_path": "./Phunk-Test/Face",
      "filename": ["Clown_Nose", "Frown", "Mole", "Smile"],
      "weights": [25, 25, 25, 25]
    },
    {
      "name": "Jewlery",
      "values": ["Earring", "Gold Chain", "Silver Chain"],
      "trait_path": "./Phunk-Test/Jewlery",
      "filename": ["Earring", "Gold_Chain", "Silver_Chain"],
      "weights": [35, 35, 30]
    },
    {
      "name": "Vice",
      "values": ["None", "Cigarette", "Vape"],
      "trait_path": "./Phunk-Test/Vice",
      "filename": ["none", "Cigarette", "Vape"],
      "weights": [35, 35, 30]
    }

  ],
  "incompatibilities": [
    {
      "layer": "Type",
      "value": "Alien",
      "incompatible_with": ["Facial Hair"],
      },
      {
        "layer": "Type",
        "value": "Ape",
        "incompatible_with": ["Facial Hair"],
        }

    }
  ],
  "baseURI": "1",
  "name": "NFT #",
  "description": "This is a description for this NFT series."
}
Jon-Becker commented 10 months ago

Your json is invalid here:

"filename": "3D_Glasses", "Big_Glasses", "Classic_Glasses", "Clown_Eyes", "Eye_Mask",

JSON arrays require brackets []