Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,26 +12,26 @@ import pickle
|
|
| 12 |
from PIL import Image
|
| 13 |
from tqdm.auto import tqdm
|
| 14 |
from datetime import datetime
|
| 15 |
-
from
|
| 16 |
if is_torch2_available():
|
| 17 |
-
from
|
| 18 |
AttnProcessor2_0 as AttnProcessor
|
| 19 |
-
# from
|
| 20 |
else:
|
| 21 |
-
from
|
| 22 |
|
| 23 |
import diffusers
|
| 24 |
from diffusers import StableDiffusionXLPipeline
|
| 25 |
from utils import PhotoMakerStableDiffusionXLPipeline
|
| 26 |
from diffusers import DDIMScheduler
|
| 27 |
import torch.nn.functional as F
|
| 28 |
-
from
|
| 29 |
import copy
|
| 30 |
import os
|
| 31 |
from huggingface_hub import hf_hub_download
|
| 32 |
from diffusers.utils import load_image
|
| 33 |
-
from utils
|
| 34 |
-
from
|
| 35 |
image_encoder_path = "./data/models/ip_adapter/sdxl_models/image_encoder"
|
| 36 |
ip_ckpt = "./data/models/ip_adapter/sdxl_models/ip-adapter_sdxl_vit-h.bin"
|
| 37 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
|
@@ -597,7 +597,7 @@ def process_generation(_sd_type,_model_type,_upload_images, _num_steps,style_nam
|
|
| 597 |
captions = [caption.replace("[NC]","") for caption in captions]
|
| 598 |
captions = [caption.split('#')[-1] if "#" in caption else caption for caption in captions]
|
| 599 |
from PIL import ImageFont
|
| 600 |
-
total_results = get_comic(id_images + real_images, _comic_type,captions= captions,font=ImageFont.truetype("./
|
| 601 |
if _model_type == "Photomaker":
|
| 602 |
pipe = pipe2.to("cpu")
|
| 603 |
pipe.id_encoder.to("cpu")
|
|
|
|
| 12 |
from PIL import Image
|
| 13 |
from tqdm.auto import tqdm
|
| 14 |
from datetime import datetime
|
| 15 |
+
from gradio_utils import is_torch2_available
|
| 16 |
if is_torch2_available():
|
| 17 |
+
from gradio_utils import \
|
| 18 |
AttnProcessor2_0 as AttnProcessor
|
| 19 |
+
# from gradio_utils import SpatialAttnProcessor2_0
|
| 20 |
else:
|
| 21 |
+
from gradio_utils import AttnProcessor
|
| 22 |
|
| 23 |
import diffusers
|
| 24 |
from diffusers import StableDiffusionXLPipeline
|
| 25 |
from utils import PhotoMakerStableDiffusionXLPipeline
|
| 26 |
from diffusers import DDIMScheduler
|
| 27 |
import torch.nn.functional as F
|
| 28 |
+
from gradio_utils import cal_attn_mask_xl
|
| 29 |
import copy
|
| 30 |
import os
|
| 31 |
from huggingface_hub import hf_hub_download
|
| 32 |
from diffusers.utils import load_image
|
| 33 |
+
from utils import get_comic
|
| 34 |
+
from style_template import styles
|
| 35 |
image_encoder_path = "./data/models/ip_adapter/sdxl_models/image_encoder"
|
| 36 |
ip_ckpt = "./data/models/ip_adapter/sdxl_models/ip-adapter_sdxl_vit-h.bin"
|
| 37 |
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
|
|
|
|
| 597 |
captions = [caption.replace("[NC]","") for caption in captions]
|
| 598 |
captions = [caption.split('#')[-1] if "#" in caption else caption for caption in captions]
|
| 599 |
from PIL import ImageFont
|
| 600 |
+
total_results = get_comic(id_images + real_images, _comic_type,captions= captions,font=ImageFont.truetype("./Inkfree.ttf", int(45))) + total_results
|
| 601 |
if _model_type == "Photomaker":
|
| 602 |
pipe = pipe2.to("cpu")
|
| 603 |
pipe.id_encoder.to("cpu")
|