Spaces:
Runtime error
Runtime error
add model
Browse files
app.py
CHANGED
|
@@ -3,13 +3,19 @@ import modin.pandas as pd
|
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
-
from diffusers import AutoPipelineForImage2Image
|
| 7 |
from diffusers.utils import load_image
|
| 8 |
import math
|
| 9 |
|
|
|
|
|
|
|
| 10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
-
pipe = AutoPipelineForImage2Image.from_pretrained(
|
|
|
|
|
|
|
| 12 |
pipe = pipe.to(device)
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def resize(value,img):
|
| 15 |
img = Image.open(img)
|
|
|
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
+
from diffusers import LCMScheduler, AutoPipelineForImage2Image
|
| 7 |
from diffusers.utils import load_image
|
| 8 |
import math
|
| 9 |
|
| 10 |
+
model_id = "segmind/Segmind-Vega"
|
| 11 |
+
adapter_id = "segmind/Segmind-VegaRT"
|
| 12 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 13 |
+
pipe = AutoPipelineForImage2Image.from_pretrained(model_id, torch_dtype=torch.float16) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained(model_id)
|
| 14 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 15 |
+
|
| 16 |
pipe = pipe.to(device)
|
| 17 |
+
pipe.load_lora_weights(adapter_id)
|
| 18 |
+
pipe.fuse_lora()
|
| 19 |
|
| 20 |
def resize(value,img):
|
| 21 |
img = Image.open(img)
|