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
Add the get back in
Browse files- handler.py +3 -1
handler.py
CHANGED
|
@@ -2,6 +2,7 @@ from typing import Dict, List, Any
|
|
| 2 |
import torch
|
| 3 |
import requests
|
| 4 |
from PIL import Image
|
|
|
|
| 5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
| 6 |
|
| 7 |
# set device
|
|
@@ -34,7 +35,8 @@ class EndpointHandler():
|
|
| 34 |
"""
|
| 35 |
prompt = data.pop("inputs", data)
|
| 36 |
url = data.pop("url", data)
|
| 37 |
-
|
|
|
|
| 38 |
init_image.thumbnail((512, 512))
|
| 39 |
|
| 40 |
params = data.pop("parameters", data)
|
|
|
|
| 2 |
import torch
|
| 3 |
import requests
|
| 4 |
from PIL import Image
|
| 5 |
+
from io import BytesIO
|
| 6 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
| 7 |
|
| 8 |
# set device
|
|
|
|
| 35 |
"""
|
| 36 |
prompt = data.pop("inputs", data)
|
| 37 |
url = data.pop("url", data)
|
| 38 |
+
response = requests.get(url)
|
| 39 |
+
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
| 40 |
init_image.thumbnail((512, 512))
|
| 41 |
|
| 42 |
params = data.pop("parameters", data)
|