Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from diffusers import StableDiffusionXLPipeline, EDMEulerScheduler, StableDiffusionXLInstructPix2PixPipeline
|
| 3 |
from custom_pipeline import CosStableDiffusionXLInstructPix2PixPipeline
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
import numpy as np
|
|
@@ -40,13 +40,15 @@ def resize_image(image, resolution):
|
|
| 40 |
|
| 41 |
EDMEulerScheduler.set_timesteps = set_timesteps_patched
|
| 42 |
|
|
|
|
|
|
|
| 43 |
pipe_edit = StableDiffusionXLInstructPix2PixPipeline.from_single_file(
|
| 44 |
-
edit_file, num_in_channels=8, is_cosxl_edit=True, torch_dtype=torch.float16
|
| 45 |
)
|
| 46 |
pipe_edit.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")
|
| 47 |
pipe_edit.to("cuda")
|
| 48 |
|
| 49 |
-
pipe_normal = StableDiffusionXLPipeline.from_single_file(normal_file, torch_dtype=torch.float16)
|
| 50 |
pipe_normal.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")
|
| 51 |
pipe_normal.to("cuda")
|
| 52 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from diffusers import StableDiffusionXLPipeline, EDMEulerScheduler, StableDiffusionXLInstructPix2PixPipeline, AutoencoderKL
|
| 3 |
from custom_pipeline import CosStableDiffusionXLInstructPix2PixPipeline
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
import numpy as np
|
|
|
|
| 40 |
|
| 41 |
EDMEulerScheduler.set_timesteps = set_timesteps_patched
|
| 42 |
|
| 43 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 44 |
+
|
| 45 |
pipe_edit = StableDiffusionXLInstructPix2PixPipeline.from_single_file(
|
| 46 |
+
edit_file, num_in_channels=8, is_cosxl_edit=True, vae=vae, torch_dtype=torch.float16,
|
| 47 |
)
|
| 48 |
pipe_edit.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")
|
| 49 |
pipe_edit.to("cuda")
|
| 50 |
|
| 51 |
+
pipe_normal = StableDiffusionXLPipeline.from_single_file(normal_file, torch_dtype=torch.float16, vae=vae)
|
| 52 |
pipe_normal.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")
|
| 53 |
pipe_normal.to("cuda")
|
| 54 |
|