Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -172,6 +172,25 @@ class ImageProcessor:
|
|
| 172 |
|
| 173 |
return pipe
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
image_processor = ImageProcessor()
|
| 177 |
|
|
|
|
| 172 |
|
| 173 |
return pipe
|
| 174 |
|
| 175 |
+
def process_image(self, input_image, prompt, negative_prompt, resolution=2048, num_inference_steps=50, guidance_scale=3, strength=0.35, hdr=0):
|
| 176 |
+
condition_image = resize_and_upscale(input_image, resolution)
|
| 177 |
+
condition_image = create_hdr_effect(condition_image, hdr)
|
| 178 |
+
|
| 179 |
+
result = self.pipe(
|
| 180 |
+
prompt=prompt,
|
| 181 |
+
negative_prompt=negative_prompt,
|
| 182 |
+
image=condition_image,
|
| 183 |
+
control_image=condition_image,
|
| 184 |
+
width=condition_image.size[0],
|
| 185 |
+
height=condition_image.size[1],
|
| 186 |
+
strength=strength,
|
| 187 |
+
num_inference_steps=num_inference_steps,
|
| 188 |
+
guidance_scale=guidance_scale,
|
| 189 |
+
generator=torch.manual_seed(0),
|
| 190 |
+
).images[0]
|
| 191 |
+
|
| 192 |
+
return result
|
| 193 |
+
|
| 194 |
|
| 195 |
image_processor = ImageProcessor()
|
| 196 |
|