Spaces:
Paused
Paused
uuu
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ image_encoder_path = "google/siglip-so400m-patch14-384"
|
|
33 |
|
34 |
transformer = SD3Transformer2DModel.from_pretrained(
|
35 |
model_path, subfolder="transformer", torch_dtype=torch.bfloat16
|
36 |
-
)
|
37 |
|
38 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
39 |
model_path, transformer=transformer, torch_dtype=torch.bfloat16
|
@@ -48,18 +48,18 @@ pipe.init_ipadapter(
|
|
48 |
|
49 |
@spaces.GPU
|
50 |
def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
return image
|
64 |
|
65 |
# Create Gradio interface
|
|
|
33 |
|
34 |
transformer = SD3Transformer2DModel.from_pretrained(
|
35 |
model_path, subfolder="transformer", torch_dtype=torch.bfloat16
|
36 |
+
)
|
37 |
|
38 |
pipe = StableDiffusion3Pipeline.from_pretrained(
|
39 |
model_path, transformer=transformer, torch_dtype=torch.bfloat16
|
|
|
48 |
|
49 |
@spaces.GPU
|
50 |
def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
|
51 |
+
with torch.no_grad():
|
52 |
+
# Ensure the pipeline runs with correct dtype and device
|
53 |
+
image = pipe(
|
54 |
+
width=1024,
|
55 |
+
height=1024,
|
56 |
+
prompt=prompt,
|
57 |
+
negative_prompt="lowres, low quality, worst quality",
|
58 |
+
num_inference_steps=24,
|
59 |
+
guidance_scale=guidance_scale,
|
60 |
+
generator=torch.Generator("cuda").manual_seed(42),
|
61 |
+
clip_image=ref_img.convert('RGB'),
|
62 |
+
ipadapter_scale=ipadapter_scale).images[0]
|
63 |
return image
|
64 |
|
65 |
# Create Gradio interface
|