Text-to-Image
Diffusers
Felguk commited on
Commit
5471f69
·
verified ·
1 Parent(s): eddb39e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -1
README.md CHANGED
@@ -38,4 +38,22 @@ from diffusers import StableDiffusionPipeline
38
 
39
  # Replace 'your-model-id' with the actual model ID on Hugging Face
40
  model_id = "your-model-id"
41
- pipeline = StableDiffusionPipeline.from_pretrained(model_id)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  # Replace 'your-model-id' with the actual model ID on Hugging Face
40
  model_id = "your-model-id"
41
+ pipeline = StableDiffusionPipeline.from_pretrained(model_id)
42
+ ```
43
+ ### Usage
44
+ ```bash
45
+ from diffusers import StableDiffusionPipeline
46
+ import torch
47
+
48
+ # Load the model
49
+ model_id = "your-model-id"
50
+ pipeline = StableDiffusionPipeline.from_pretrained(model_id)
51
+ pipeline.to("cuda") # Use GPU if available
52
+
53
+ # Generate an image from text
54
+ prompt = "A beautiful sunset over the mountains"
55
+ image = pipeline(prompt).images[0]
56
+
57
+ # Save the generated image
58
+ image.save("generated_image.png")
59
+ ```