stoc / README.md
Tugfbk's picture
Update README.md
f4213af
|
Raw
History Blame Contribute Delete
1.26 kB
import random
from transformers import AutoModelForPrompt, AutoTokenizer
from PIL import Image
# Load the model and tokenizer
model = AutoModelForPrompt.from_pretrained("bigscience/bigsleep-14m")
tokenizer = AutoTokenizer.from_pretrained("bigscience/bigsleep-14m")
# Define a list of Stranger Things character names
names = ["Mike", "Eleven", "Dustin", "Lucas", "Will", "Joyce", "Jim", "Nancy", "Jonathan", "Steve", "Robin", "Erica", "Max", "Billy"]
# Define a list of Stranger Things character traits
traits = ["brave", "intelligent", "witty", "sarcastic", "determined", "loyal", "protective", "kind", "compassionate", "troubled", "mysterious", "powerful"]
# Define a list of Stranger Things locations
locations = ["Hawkins National Laboratory", "Mirkwood Forest", "The Upside Down", "Starcourt Mall", "Hawkins Middle School", "Hawkins High School"]
# Generate a random prompt for the model
prompt = f"A photorealistic portrait of a Stranger Things OC named {random.choice(names)} with {random.choice(traits)} eyes and {random.choice(traits)} hair. The OC is standing in {random.choice(locations)}."
#Generate the image
image = model.generate_image(prompt)
#Save the image to a file
image.save("oc.png")
#Display the image
Image.open("oc.png").show()