AnisNewSpace / app.py
comingboi's picture
Update app.py
cd5d8f5 verified
raw
history blame contribute delete
576 Bytes
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)