Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,18 +14,8 @@ api = HfApi()
|
|
| 14 |
import torch
|
| 15 |
from diffusers import DiffusionPipeline, AutoencoderKL
|
| 16 |
|
| 17 |
-
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 18 |
-
|
| 19 |
-
pipe = DiffusionPipeline.from_pretrained(
|
| 20 |
-
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 21 |
-
vae=vae, torch_dtype=torch.float16, variant="fp16",
|
| 22 |
-
use_safetensors=True
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 26 |
|
| 27 |
-
pipe.to(device)
|
| 28 |
-
|
| 29 |
def get_files(file_paths):
|
| 30 |
last_files = {} # Dictionary to store the last file for each path
|
| 31 |
|
|
@@ -72,7 +62,17 @@ def load_model(custom_model):
|
|
| 72 |
|
| 73 |
|
| 74 |
def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
|
|
|
|
|
|
| 76 |
if weight_name == "NO SAFETENSORS FILE":
|
| 77 |
pipe.load_lora_weights(
|
| 78 |
custom_model,
|
|
|
|
| 14 |
import torch
|
| 15 |
from diffusers import DiffusionPipeline, AutoencoderKL
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
|
|
|
|
|
|
|
| 19 |
def get_files(file_paths):
|
| 20 |
last_files = {} # Dictionary to store the last file for each path
|
| 21 |
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def infer (custom_model, weight_name, prompt, inf_steps, guidance_scale, seed, lora_weight, progress=gr.Progress(track_tqdm=True)):
|
| 65 |
+
|
| 66 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 67 |
+
|
| 68 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 69 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 70 |
+
vae=vae, torch_dtype=torch.float16, variant="fp16",
|
| 71 |
+
use_safetensors=True
|
| 72 |
+
)
|
| 73 |
|
| 74 |
+
pipe.to(device)
|
| 75 |
+
|
| 76 |
if weight_name == "NO SAFETENSORS FILE":
|
| 77 |
pipe.load_lora_weights(
|
| 78 |
custom_model,
|