Spaces:
Runtime error
Runtime error
from transformers import pipeline, GPT2Tokenizer | |
# Load the pre-trained GPT-2 model and tokenizer | |
model = pipeline("text-generation", model="gpt2") | |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2") | |
# Generate an image from input text | |
text = "A blue bird flying in the sky" | |
input_ids = tokenizer.encode(text, return_tensors="pt") | |
output = model.generate(input_ids=input_ids, max_length=1024, do_sample=True) | |
image = generate_image_from_output(output) | |
# Display the generated image | |
image.show() | |