Created
January 12, 2023 01:28
-
-
Save victormurcia/5f2dea48f4c7017801cf4890e5df18d6 to your computer and use it in GitHub Desktop.
make Pokemon From Pokedex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makePokemonFromPokedex(ver,nPokemon): | |
#Loop over nPokemons to get the descritptions and generate images for each | |
#poke_id = 1 | |
for poke_id in range(1, nPokemon+1, 1): | |
#print(poke_id) | |
#Specify which Pokemon we want to query using its ID number | |
pokemon = pypokedex.get(dex=poke_id) | |
#print(pokemon) | |
#This is the name of the Pokemon we are querying | |
poke_name = pokemon.name | |
#This is the PokeDex desciption for the current Pokemon | |
yellow_description = pokemon.get_descriptions()[ver] | |
#This is the prompt I'll feed to the AI | |
prompt = poke_name + " " + yellow_description | |
#print(prompt) | |
remove_safety = False | |
num_images = 4 | |
if remove_safety: | |
negative_prompt = None | |
else: | |
negative_prompt = "nude, naked" | |
images = pipe( | |
prompt, | |
height = image_length, | |
width = image_length, | |
num_inference_steps = 25, | |
guidance_scale = 9, | |
num_images_per_prompt = num_images, | |
negative_prompt = negative_prompt, | |
).images | |
fname = 'poke_' + str(poke_id) | |
get_concat_h_multi_blank(images).save(fname + '.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment