Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,7 @@ def king(type ,
|
|
| 74 |
raw_image = Image.open(input_image).convert('RGB')
|
| 75 |
inputs = processor(raw_image, return_tensors="pt").to("cuda", torch.float16)
|
| 76 |
pixel_values = inputs.pixel_values
|
| 77 |
-
out = model.generate(pixel_values=pixel_values, max_length=
|
| 78 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
| 79 |
instructions = f"{instruction} {caption} {instruction}"
|
| 80 |
print(instructions)
|
|
@@ -86,7 +86,7 @@ def king(type ,
|
|
| 86 |
steps=steps
|
| 87 |
generator = torch.manual_seed(seed)
|
| 88 |
output_image = pipe_edit(
|
| 89 |
-
instructions, image=
|
| 90 |
guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
|
| 91 |
num_inference_steps=steps, generator=generator, output_type="latent",
|
| 92 |
).images
|
|
|
|
| 74 |
raw_image = Image.open(input_image).convert('RGB')
|
| 75 |
inputs = processor(raw_image, return_tensors="pt").to("cuda", torch.float16)
|
| 76 |
pixel_values = inputs.pixel_values
|
| 77 |
+
out = model.generate(pixel_values=pixel_values, max_length=20, num_beams=3, repetition_penalty=2.5)
|
| 78 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
| 79 |
instructions = f"{instruction} {caption} {instruction}"
|
| 80 |
print(instructions)
|
|
|
|
| 86 |
steps=steps
|
| 87 |
generator = torch.manual_seed(seed)
|
| 88 |
output_image = pipe_edit(
|
| 89 |
+
instructions, image=raw_image,
|
| 90 |
guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
|
| 91 |
num_inference_steps=steps, generator=generator, output_type="latent",
|
| 92 |
).images
|