Spaces:
Runtime error
Runtime error
File size: 576 Bytes
cd5d8f5 ed6717c cd5d8f5 9270fdf cd5d8f5 afff454 cd5d8f5 ad4ad05 ed6717c cd5d8f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from diffusers import StableDiffusionPipeline
import torch
def generate_image(prompt):
model_id = "runwayml/stable-diffusion-v1-5"
token = "hf_your_huggingface_token_here" # Replace with your Hugging Face token
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=token)
pipe = pipe.to("cpu") # Use CPU
image = pipe(prompt, num_inference_steps=15).images[0] # Fewer steps β faster
image.show()
if __name__ == "__main__":
prompt = "A fantasy forest with glowing plants, at night, ultra vibrant"
generate_image(prompt) |