Text-to-Image
Diffusers
Safetensors
English
StableDiffusionXLInpaintPipeline
stable-diffusion-xl
stable-diffusion-xl-diffusers
inpainting
Instructions to use mrcuddle/URPM-Inpaint-SDXL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mrcuddle/URPM-Inpaint-SDXL with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mrcuddle/URPM-Inpaint-SDXL", torch_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 Settings
- Draw Things
- DiffusionBee
Update handler.py
Browse files- handler.py +4 -3
handler.py
CHANGED
|
@@ -11,8 +11,8 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
| 11 |
if device.type != 'cuda':
|
| 12 |
raise ValueError("Need to run on GPU")
|
| 13 |
|
| 14 |
-
class
|
| 15 |
-
def __init__(self, path="mrcuddle/
|
| 16 |
"""Load the SDXL Inpainting model."""
|
| 17 |
self.pipeline = StableDiffusionXLInpaintPipeline.from_pretrained(
|
| 18 |
path, torch_dtype=torch.float16
|
|
@@ -69,7 +69,8 @@ class SDXLInpaintHandler:
|
|
| 69 |
image.save(buffered, format="PNG")
|
| 70 |
return base64.b64encode(buffered.getvalue()).decode("utf-8")
|
| 71 |
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
def handle(data: dict):
|
| 75 |
return handler(data)
|
|
|
|
| 11 |
if device.type != 'cuda':
|
| 12 |
raise ValueError("Need to run on GPU")
|
| 13 |
|
| 14 |
+
class EndpointHandler:
|
| 15 |
+
def __init__(self, path="mrcuddle/URPM-Inpaint-Hyper-SDXL"):
|
| 16 |
"""Load the SDXL Inpainting model."""
|
| 17 |
self.pipeline = StableDiffusionXLInpaintPipeline.from_pretrained(
|
| 18 |
path, torch_dtype=torch.float16
|
|
|
|
| 69 |
image.save(buffered, format="PNG")
|
| 70 |
return base64.b64encode(buffered.getvalue()).decode("utf-8")
|
| 71 |
|
| 72 |
+
# Create an instance of EndpointHandler
|
| 73 |
+
handler = EndpointHandler()
|
| 74 |
|
| 75 |
def handle(data: dict):
|
| 76 |
return handler(data)
|