Update app.py
Browse files
app.py
CHANGED
|
@@ -88,18 +88,14 @@ text_encoder=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusi
|
|
| 88 |
text_encoder_2=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_2',token=True).to(device=device, dtype=torch.bfloat16)
|
| 89 |
text_encoder_3=T5EncoderModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_3',token=True).to(device=device, dtype=torch.bfloat16)
|
| 90 |
|
| 91 |
-
|
| 92 |
-
ip_adapter_path=ipadapter_path,
|
| 93 |
-
image_encoder_path=image_encoder_path,
|
| 94 |
-
nb_token=64,
|
| 95 |
-
)
|
| 96 |
|
| 97 |
upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
|
| 98 |
|
| 99 |
MAX_SEED = np.iinfo(np.int32).max
|
| 100 |
MAX_IMAGE_SIZE = 4096
|
| 101 |
|
| 102 |
-
@spaces.GPU(duration=
|
| 103 |
def infer(
|
| 104 |
prompt,
|
| 105 |
negative_prompt_1,
|
|
@@ -124,9 +120,16 @@ def infer(
|
|
| 124 |
image_encoder_path=None,
|
| 125 |
progress=gr.Progress(track_tqdm=True),
|
| 126 |
):
|
|
|
|
| 127 |
pipe.text_encoder=text_encoder
|
| 128 |
pipe.text_encoder_2=text_encoder_2
|
| 129 |
pipe.text_encoder_3=text_encoder_3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
upscaler_2.to(torch.device('cpu'))
|
| 131 |
torch.set_float32_matmul_precision("highest")
|
| 132 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 88 |
text_encoder_2=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_2',token=True).to(device=device, dtype=torch.bfloat16)
|
| 89 |
text_encoder_3=T5EncoderModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_3',token=True).to(device=device, dtype=torch.bfloat16)
|
| 90 |
|
| 91 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
|
| 94 |
|
| 95 |
MAX_SEED = np.iinfo(np.int32).max
|
| 96 |
MAX_IMAGE_SIZE = 4096
|
| 97 |
|
| 98 |
+
@spaces.GPU(duration=80)
|
| 99 |
def infer(
|
| 100 |
prompt,
|
| 101 |
negative_prompt_1,
|
|
|
|
| 120 |
image_encoder_path=None,
|
| 121 |
progress=gr.Progress(track_tqdm=True),
|
| 122 |
):
|
| 123 |
+
|
| 124 |
pipe.text_encoder=text_encoder
|
| 125 |
pipe.text_encoder_2=text_encoder_2
|
| 126 |
pipe.text_encoder_3=text_encoder_3
|
| 127 |
+
|
| 128 |
+
pipe.init_ipadapter(
|
| 129 |
+
ip_adapter_path=ipadapter_path,
|
| 130 |
+
image_encoder_path=image_encoder_path,
|
| 131 |
+
nb_token=64,
|
| 132 |
+
)
|
| 133 |
upscaler_2.to(torch.device('cpu'))
|
| 134 |
torch.set_float32_matmul_precision("highest")
|
| 135 |
seed = random.randint(0, MAX_SEED)
|