Add example inference code
Browse files
README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```python
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
pipe = DiffusionPipeline.from_pretrained(
|
6 |
+
"playgroundai/playground-v2-512px-base",
|
7 |
+
torch_dtype=torch.float16,
|
8 |
+
use_safetensors=True,
|
9 |
+
variant="fp16"
|
10 |
+
)
|
11 |
+
pipe.to("cuda")
|
12 |
+
|
13 |
+
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
14 |
+
image = pipe(prompt=prompt, width=512, height=512).images[0]
|
15 |
+
```
|