MaxMilan1
commited on
Commit
·
e90f748
1
Parent(s):
f8cb6f9
CHA
Browse files- util/text_img.py +5 -3
util/text_img.py
CHANGED
|
@@ -15,6 +15,10 @@ def check_prompt(prompt):
|
|
| 15 |
if prompt is None:
|
| 16 |
raise gr.Error("Please enter a prompt!")
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
controlNet_normal = ControlNetModel.from_pretrained(
|
| 19 |
"fusing/stable-diffusion-v1-5-controlnet-normal",
|
| 20 |
torch_dtype=torch.float16
|
|
@@ -57,9 +61,7 @@ def generate_txttoimg(prompt, control_image, controlnet):
|
|
| 57 |
def generate_imgtoimg(prompt, init_image, strength=0.5):
|
| 58 |
prompt += ", no background, side view, minimalist shot, single shoe, no legs, product photo"
|
| 59 |
|
| 60 |
-
imagepipe
|
| 61 |
-
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float32, use_safetensors=True
|
| 62 |
-
)
|
| 63 |
|
| 64 |
image = imagepipe(prompt, image=init_image, strength=strength).images[0]
|
| 65 |
|
|
|
|
| 15 |
if prompt is None:
|
| 16 |
raise gr.Error("Please enter a prompt!")
|
| 17 |
|
| 18 |
+
imagepipe = AutoPipelineForImage2Image.from_pretrained(
|
| 19 |
+
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float32, use_safetensors=True
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
controlNet_normal = ControlNetModel.from_pretrained(
|
| 23 |
"fusing/stable-diffusion-v1-5-controlnet-normal",
|
| 24 |
torch_dtype=torch.float16
|
|
|
|
| 61 |
def generate_imgtoimg(prompt, init_image, strength=0.5):
|
| 62 |
prompt += ", no background, side view, minimalist shot, single shoe, no legs, product photo"
|
| 63 |
|
| 64 |
+
imagepipe.to("cuda")
|
|
|
|
|
|
|
| 65 |
|
| 66 |
image = imagepipe(prompt, image=init_image, strength=strength).images[0]
|
| 67 |
|