Created
September 3, 2022 13:42
-
-
Save t4t5/02a840ce4eea3ff83c3e7e7e13a5806c to your computer and use it in GitHub Desktop.
Stable Diffusion script
This file contains 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
#!/bin/bash | |
SD_DIR=~/dev/tools/stable-diffusion | |
cd $SD_DIR | |
source venv/bin/activate | |
echo -n "Enter a prompt: " | |
read prompt | |
echo -n "Quality (0-100, default 50): " | |
read steps | |
if [[ -z "$steps" ]]; then | |
steps=50 | |
fi | |
declare -A art_styles | |
art_styles["Digital Painting"]=", vibrantcolors, awardwinning, intricate, insanelydetailed, digitalpainting, conceptart" | |
art_styles["Fantasy Art"]=", trending on artstation, style Greg Rutkowski" | |
art_styles["Landscape Painting"]=", by Caspar David Friedrich, matte painting trending on artstation HQ" | |
art_styles["Photorealistic"]=", dlsr photography, sharp focus, perfect light" | |
art_styles["Digital Art"]=", intricate, cinematic lighting, highly detailed, digital painting, artstation, concept art, sharp focus, illustration, illustrated by Sophie Anderson, Mark Arian" | |
art_styles["CG Art"]=", colorful, artstation, cgsociety" | |
art_styles["Cinematic"]=", cinematic photo, highly detailed, cinematic lighting, ultra-detailed, ultrarealistic, photorealism, 8k, octane render" | |
art_styles["none"]="" | |
echo "What kind of style do you want?" | |
select art_style in "${!art_styles[@]}"; do | |
art_style_value="${art_styles[$art_style]}" | |
echo -n "How many versions? (default 1): " | |
read number | |
if [[ -z "$number" ]]; then | |
number=1 | |
fi | |
number=$((number + 0)) | |
# Generate image: | |
python scripts/txt2img.py \ | |
--prompt "$prompt$art_style_value" \ | |
--n_samples $number --n_iter 1 --plms --ddim_steps "$steps" | |
# Go to output dir: | |
cd "$SD_DIR/outputs/txt2img-samples" | |
# Open last modified file in directory: | |
open $(ls -Art | tail -n 1) | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment