Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ import random
|
|
5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
|
6 |
import torch
|
7 |
|
|
|
|
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
all_model_id = {
|
10 |
"DreamShaper-8": "Lykon/dreamshaper-8",
|
@@ -30,6 +32,7 @@ def infer_t2i(model, prompt, negative_prompt, seed, randomize_seed, width, heigh
|
|
30 |
|
31 |
pipe = StableDiffusionPipeline.from_pretrained(all_model_id[model], torch_dtype=torch_dtype)
|
32 |
pipe = pipe.to(device)
|
|
|
33 |
|
34 |
image = pipe(
|
35 |
prompt = prompt,
|
@@ -53,6 +56,7 @@ def infer_i2i(model, prompt, image, strength, negative_prompt, seed, randomize_s
|
|
53 |
|
54 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(all_model_id[model], torch_dtype=torch_dtype)
|
55 |
pipe = pipe.to(device)
|
|
|
56 |
|
57 |
image = pipe(
|
58 |
prompt = prompt,
|
@@ -80,6 +84,7 @@ def infer_ip_adapter(model, prompt, image, scale, negative_prompt, seed, randomi
|
|
80 |
pipe = pipe.to(device)
|
81 |
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter-plus_sd15.bin")
|
82 |
pipeline.set_ip_adapter_scale(scale)
|
|
|
83 |
|
84 |
image = pipe(
|
85 |
prompt = prompt,
|
|
|
5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
|
6 |
import torch
|
7 |
|
8 |
+
from src.linfusion import LinFusion
|
9 |
+
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
all_model_id = {
|
12 |
"DreamShaper-8": "Lykon/dreamshaper-8",
|
|
|
32 |
|
33 |
pipe = StableDiffusionPipeline.from_pretrained(all_model_id[model], torch_dtype=torch_dtype)
|
34 |
pipe = pipe.to(device)
|
35 |
+
linfusion = LinFusion.construct_for(pipe)
|
36 |
|
37 |
image = pipe(
|
38 |
prompt = prompt,
|
|
|
56 |
|
57 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(all_model_id[model], torch_dtype=torch_dtype)
|
58 |
pipe = pipe.to(device)
|
59 |
+
linfusion = LinFusion.construct_for(pipe)
|
60 |
|
61 |
image = pipe(
|
62 |
prompt = prompt,
|
|
|
84 |
pipe = pipe.to(device)
|
85 |
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter-plus_sd15.bin")
|
86 |
pipeline.set_ip_adapter_scale(scale)
|
87 |
+
linfusion = LinFusion.construct_for(pipe)
|
88 |
|
89 |
image = pipe(
|
90 |
prompt = prompt,
|