Update README.md
Browse files
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 |
+
```
|