Instructions to use glowforge-dev/stable-diffusion-2-1-base-custom with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use glowforge-dev/stable-diffusion-2-1-base-custom with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("glowforge-dev/stable-diffusion-2-1-base-custom", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Update handler for testing
Browse files- handler.py +1 -6
handler.py
CHANGED
|
@@ -2,8 +2,6 @@ from typing import Dict, List, Any
|
|
| 2 |
import torch
|
| 3 |
from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler
|
| 4 |
from PIL import Image
|
| 5 |
-
import base64
|
| 6 |
-
from io import BytesIO
|
| 7 |
|
| 8 |
|
| 9 |
# set device
|
|
@@ -52,7 +50,4 @@ class EndpointHandler():
|
|
| 52 |
)
|
| 53 |
|
| 54 |
# return first generate PIL image
|
| 55 |
-
|
| 56 |
-
buffered = BytesIO()
|
| 57 |
-
image.save(buffered, format="JPEG")
|
| 58 |
-
return base64.b64encode(buffered.getvalue())
|
|
|
|
| 2 |
import torch
|
| 3 |
from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler
|
| 4 |
from PIL import Image
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
# set device
|
|
|
|
| 50 |
)
|
| 51 |
|
| 52 |
# return first generate PIL image
|
| 53 |
+
return out.images[0]
|
|
|
|
|
|
|
|
|