traffic_roads / app.py
Nawinkumar15's picture
Update app.py
423953d verified
raw
history blame contribute delete
666 Bytes
ffrom diffusers import StableDiffusionPipeline
import torch
# Load the pre-trained Stable Diffusion model from Hugging Face
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4-original", torch_dtype=torch.float16)
pipe = pipe.to("cuda") # If you have a GPU, otherwise, remove this line for CPU usage
# Define the prompt for the image
prompt = "A huge traffic of people walking around a road, busy city street, crowded with pedestrians, some cars visible, daytime, urban setting"
# Generate the image
image = pipe(prompt).images[0]
# Save the image to a file
image.save("crowded_road.jpg")
# Display the image
image.show()
image.show()