Instructions to use Elvenson/diffuser_inference with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Elvenson/diffuser_inference with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Elvenson/diffuser_inference", 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
Quoc Bao Bui commited on
Commit ·
80ac413
1
Parent(s): e5e883d
Add debug log, change directory
Browse files- handler.py +3 -1
handler.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import base64
|
| 2 |
from io import BytesIO
|
| 3 |
from typing import Dict, List, Any
|
|
|
|
| 4 |
|
| 5 |
import torch
|
| 6 |
from PIL import Image
|
|
@@ -16,7 +17,8 @@ def decode_base64_image(image_string):
|
|
| 16 |
|
| 17 |
class EndpointHandler:
|
| 18 |
def __init__(self, path=""):
|
| 19 |
-
|
|
|
|
| 20 |
self.pipe = self.pipe.to("cuda")
|
| 21 |
|
| 22 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
|
|
|
| 1 |
import base64
|
| 2 |
from io import BytesIO
|
| 3 |
from typing import Dict, List, Any
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
import torch
|
| 7 |
from PIL import Image
|
|
|
|
| 17 |
|
| 18 |
class EndpointHandler:
|
| 19 |
def __init__(self, path=""):
|
| 20 |
+
print(list(os.walk(".")))
|
| 21 |
+
self.pipe = StableDiffusionPipeline.from_pretrained("/repository/stable-diffusion-v1-5")
|
| 22 |
self.pipe = self.pipe.to("cuda")
|
| 23 |
|
| 24 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|